fix(dotnet): preserve Context and ForwardedProperties from caller-supplied RunAgentInput#2164
fix(dotnet): preserve Context and ForwardedProperties from caller-supplied RunAgentInput#2164NathanTarbert wants to merge 1 commit into
Conversation
…plied RunAgentInput AGUIChatClient.BuildRunAgentInput copied Messages, Tools, State, and ParentRunId from a RunAgentInput supplied via ChatOptions.RawRepresentationFactory, but never copied Context or ForwardedProperties. Both were silently dropped from the request sent over the wire, even though they are documented caller-supplied run parameters. Carry both through with the same guarded treatment as the other fields: copy Context when non-empty, and ForwardedProperties when the caller set it (ValueKind is not Undefined). Fixes #2151
Python Preview PackagesVersion
Install with uvAdd the TestPyPI index to your [[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
explicit = trueThen install the packages you need: # Core SDK
uv add 'ag-ui-protocol==0.0.0.dev1783805828' --index testpypi
# Integrations (each already depends on the matching ag-ui-protocol preview)
uv add 'ag-ui-langgraph==0.0.0.dev1783805828' --index testpypi
uv add 'ag-ui-crewai==0.0.0.dev1783805828' --index testpypi
# NOTE: ag-ui-agent-spec depends on pyagentspec (git-only, not on PyPI).
# You will need to install pyagentspec separately from its git repo.
uv add 'ag-ui-agent-spec==0.0.0.dev1783805828' --index testpypi
uv add 'ag_ui_adk==0.0.0.dev1783805828' --index testpypi
uv add 'ag_ui_strands==0.0.0.dev1783805828' --index testpypiInstall with pippip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
ag-ui-protocol==0.0.0.dev1783805828
Commit: 5427afd |
@ag-ui/a2a-middleware
@ag-ui/a2ui-middleware
@ag-ui/event-throttle-middleware
@ag-ui/mcp-apps-middleware
@ag-ui/mcp-middleware
@ag-ui/a2a
@ag-ui/adk
@ag-ui/ag2
@ag-ui/agno
@ag-ui/aws-strands
@ag-ui/claude-agent-sdk
@ag-ui/crewai
@ag-ui/langchain
@ag-ui/langgraph
@ag-ui/llamaindex
@ag-ui/mastra
@ag-ui/pydantic-ai
@ag-ui/vercel-ai-sdk
@ag-ui/watsonx
@ag-ui/a2ui-toolkit
create-ag-ui-app
@ag-ui/client
@ag-ui/core
@ag-ui/encoder
@ag-ui/proto
commit: |
|
LGTM |
|
Thanks so much for this, @NathanTarbert — and apologies again for the duplicate; you spotted the That fix has now landed via #2177 (merged in 828e444), which used the same guarded pattern as yours and additionally forwards Since #2177 is the superset, I'm closing this as a duplicate — but the credit for catching the original issue is yours. Really appreciate the contribution. 🙏 |
Fixes #2151
Problem
When a caller seeds the outgoing request with a
RunAgentInputviaChatOptions.RawRepresentationFactory,AGUIChatClient.BuildRunAgentInputcopiesMessages,Tools,State, andParentRunIdfrom that input — but never copiesContextorForwardedProperties. Both fields are silently dropped, even though they are part of the sameRunAgentInputand are documented as caller-supplied run parameters.Affects
AGUI.Client/AGUI.Abstractions0.0.3.Fix
In
BuildRunAgentInput, carry both fields through with the same guarded treatment as the existing fields:ForwardedPropertiesis aJsonElementvalue type whose default isValueKind == Undefined, so the guard copies it only when the caller actually set it.Tests
GetStreamingResponse_WithRawRepresentationFactory_PreservesContextAndForwardedProperties(uses the existingCapturingTransportto assert both fields reach the sentRunAgentInput).BuildRunAgentInput(Contextis null) and passes with the fix.AGUI.Client.UnitTestssuite green (111 passed, net10.0).