sdk-python icon indicating copy to clipboard operation
sdk-python copied to clipboard

[FEATURE] Reach parity on AgentStreamStage context contracts

Open liramon2 opened this issue 3 months ago • 0 comments

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.

liramon2 avatar Aug 06 '26 19:08 liramon2