Skip to content

Python: Preserve Responses replay metadata across AG-UI continuations #7905

Description

Description

AG-UI multi-turn replay exercises two distinct continuation modes:

  • stateless snapshot replay, where the complete message history is provider input;
  • service-session continuation, where only the incremental turn is provider input and the provider conversation/response ID is persisted privately.

The current implementation has two gaps found by a provider compatibility matrix:

  1. Stateless AG-UI can persist a provider response ID from store=True and later combine full-history replay with previous_response_id.
  2. OpenAI Responses parses real assistant output_text.logprobs into response metadata but does not retain them on the assistant content for direct replay.

Expected behavior:

  • Provider continuation IDs are persisted only when use_service_session=True.
  • use_service_session=True fails clearly when provider storage is explicitly disabled.
  • Real assistant logprobs are preserved and mirrored during direct Responses replay; absent logprobs are not fabricated.
  • OpenAI, FoundryChatClient, Prompt Agent, and Hosted Agent continuation modes have live two-turn AG-UI integration coverage.

Code Sample

AgentFrameworkAgent(
    agent=agent,
    use_service_session=True,
    snapshot_store=snapshot_store,
)

Error Messages / Stack Traces

Foundry Hosted Agent stateless replay currently rejects assistant output_text without logprobs:

400 invalid_request
request body failed schema validation
Expected one of: string, array; got array
param: $.input

Package Versions

agent-framework-core: development main; agent-framework-ag-ui: development main; agent-framework-openai: development main; agent-framework-foundry: development main

Python Version

Python 3.13

Additional Context

The Hosted Agent stateless replay case should remain a strict expected failure until the upstream service accepts standard assistant output_text replay without fabricated logprobs. The strict xfail should be removed when that service fix lands.

Activity

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

Metadata

Metadata

Labels

ag-uiUsage: [Issues, PRs], Target: AG-UI protocol integrationpythonUsage: [Issues, PRs], Target: Python

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions