feat(interactions): add previous_interaction_id for multi-turn conversations#5669
feat(interactions): add previous_interaction_id for multi-turn conversations#5669leseb wants to merge 5 commits intoogx-ai:mainfrom
Conversation
…sations Add server-side conversation state to the Google Interactions API so that ADK agents can chain requests via previous_interaction_id. Without this, every request starts fresh and there is no way to maintain context across turns. The implementation introduces an InteractionsStore (SQL-backed via AuthorizedSqlStore, following the ResponsesStore pattern) that persists each completed interaction. When a request includes previous_interaction_id, the stored conversation history is fetched and prepended to the new input before calling the inference API. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Sébastien Han <seb@redhat.com>
|
This pull request has merge conflicts that must be resolved before it can be merged. @leseb please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork |
…8-v4 Signed-off-by: Sébastien Han <seb@redhat.com>
✱ Stainless preview buildsThis PR will update the Edit this comment to update it. It will appear in the SDK's changelogs. ✅ llama-stack-client-go studio · conflict
✅ llama-stack-client-openapi studio · code · diff
✅ llama-stack-client-python studio · code · diff
✅ llama-stack-client-node studio · code · diff
This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push. |
… script Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Sébastien Han <seb@redhat.com>
…seb/leseb/rhaistrat-1348-v4
cdoern
left a comment
There was a problem hiding this comment.
lgtm, one question on some removed tests
| run_non_streaming_system_instruction, | ||
| run_non_streaming_multi_turn, | ||
| run_non_streaming_generation_config, | ||
| run_tool_calling, |
There was a problem hiding this comment.
nit, but what happened to run_tool_calling?
What does this PR do?
Adds
previous_interaction_idsupport to the Google Interactions API, enabling server-side conversation state for multi-turn interactions. Without this, every request starts fresh and ADK agents cannot maintain context across turns.When a request includes
previous_interaction_id, the server fetches the stored conversation history from the SQL backend, prepends it (including the model's prior response) to the new input, and calls inference with the full context. Both streaming and non-streaming responses are persisted for future chaining.Key additions:
InteractionsStoreclass (src/ogx/providers/utils/interactions/) following theResponsesStorepattern withAuthorizedSqlStoreand access control policyInteractionsConfigwithSqlStoreReferencefor configurable SQL backend (SQLite/Postgres)_build_messages()method for conversation history reconstruction, supporting multi-hop chainingTest Plan
55 unit tests pass (37 existing + 5 new
previous_interaction_id+ 13 shape/passthrough tests). All 39 pre-commit hooks pass.Test 5 validates conversation chaining: creates a first interaction establishing context ("My name is Alice"), then chains from it with
previous_interaction_idand verifies the model remembers the name.