Skip to content

[FEATURE] Reach parity on AgentStreamStage context contracts #3693

Description

@liramon2

SDK Language

Both

Problem Statement

The Python SDK's AgentStreamContext currently includes agent, messages, and invocation_state. The TS SDK includes the same fields, plus invokeArgs, limits (inside invokeOptions), and structuredOutput (inside invokeOptions). The TS context contract must be finalized (particularly around copy vs reference semantics for args/options) and the SDKs must reach parity on AgentStreamContext fields before either AgentStreamStage can go public.

Proposed Solution

Add the equivalent of limits and structuredOutput to the Python SDK's AgentStreamContext. Handle them in the same way as the TS SDK.

Use Case

  • Middleware author wants to inspects or modifies usage limits before continuing with the invocation
  • Middleware author wants to inject a response schema matching their endpoint's specifications

Alternatives Solutions

No response

Additional Context

The TS SDK includes messages from the current pass inside of agent. While messages is also accessible from agent in the Python SDK, it includes the full conversation history. messages from the current pass are stored separately in AgentStreamContext to address this divergence.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Language

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions