Skip to content

feat(interactions): add previous_interaction_id for multi-turn conversations#5669

Open
leseb wants to merge 5 commits intoogx-ai:mainfrom
leseb:leseb/rhaistrat-1348-v4
Open

feat(interactions): add previous_interaction_id for multi-turn conversations#5669
leseb wants to merge 5 commits intoogx-ai:mainfrom
leseb:leseb/rhaistrat-1348-v4

Conversation

@leseb
Copy link
Copy Markdown
Collaborator

@leseb leseb commented Apr 30, 2026

What does this PR do?

Adds previous_interaction_id support 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:

  • InteractionsStore class (src/ogx/providers/utils/interactions/) following the ResponsesStore pattern with AuthorizedSqlStore and access control policy
  • InteractionsConfig with SqlStoreReference for configurable SQL backend (SQLite/Postgres)
  • _build_messages() method for conversation history reconstruction, supporting multi-hop chaining
  • Updated Google Interactions API conformance score (39.0% → 40.2%)

Test Plan

55 unit tests pass (37 existing + 5 new previous_interaction_id + 13 shape/passthrough tests). All 39 pre-commit hooks pass.

# Unit tests
uv run pytest tests/unit/providers/inline/interactions/ -x --tb=short -q

# End-to-end validation with Google GenAI SDK
OLLAMA_URL=http://localhost:11434/v1 uv run --extra starter ogx stack run starter --port 8321
uv run scripts/test_interactions_api.py --base-url http://localhost:8321 --model ollama/llama3.2:3b

Test 5 validates conversation chaining: creates a first interaction establishing context ("My name is Alice"), then chains from it with previous_interaction_id and verifies the model remembers the name.

…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>
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 30, 2026

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

@mergify mergify Bot added the needs-rebase label Apr 30, 2026
@leseb leseb marked this pull request as draft April 30, 2026 14:09
…8-v4

Signed-off-by: Sébastien Han <seb@redhat.com>
@mergify mergify Bot removed the needs-rebase label Apr 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 30, 2026

✱ Stainless preview builds

This PR will update the llama-stack-client SDKs with the following commit message.

feat(interactions): add previous_interaction_id for multi-turn conversations

Edit this comment to update it. It will appear in the SDK's changelogs.

llama-stack-client-go studio · conflict

Your SDK build resulted in a merge conflict between your custom code and the newly generated changes, but this did not represent a regression.

llama-stack-client-openapi studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
generate ⚠️

llama-stack-client-python studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
generate ⚠️build ⏭️ (prev: build ✅) → lint ⏭️ (prev: lint ✅) → test ✅

llama-stack-client-node studio · code · diff

Your SDK build had at least one "warning" diagnostic, but this did not represent a regression.
generate ⚠️build ⏭️ (prev: build ✅) → lint ⏭️ (prev: lint ✅) → test ✅


This comment is auto-generated by GitHub Actions and is automatically kept up to date as you push.
If you push custom code to the preview branch, re-run this workflow to update the comment.
Last updated: 2026-05-06 03:26:24 UTC

@leseb leseb marked this pull request as ready for review May 5, 2026 19:13
leseb and others added 3 commits May 5, 2026 21:15
… script

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Signed-off-by: Sébastien Han <seb@redhat.com>
Copy link
Copy Markdown
Collaborator

@cdoern cdoern left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, but what happened to run_tool_calling?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants