Skip to content

[.NET] RunAgentInput.Context is not forwarded to model-visible context #2840

Description

@sheng-jie

Problem

The AG-UI 1.0 run input specification says that Context exists to be injected and that a producer should make every context entry available to the model as part of the run grounding.

The current .NET SDK adapter does not appear to perform that injection. In sdks/dotnet/src/AGUI.Server/RunAgentInputExtensions.cs, ToChatRequestContext:

  • converts input.Messages into ChatRequestContext.Messages;
  • stores the complete RunAgentInput in ChatOptions.AdditionalProperties[agui_input];
  • does not convert input.Context into ChatMessage content, ChatOptions.Instructions, or another model-visible context representation.

ChatRequestContext.Messages is documented as containing messages adapted from RunAgentInput.Messages. The only apparent application-level path is to recover the original input with ChatOptions.TryGetRunAgentInput and implement custom context plumbing.

This means a frontend using useAgentContext can send context successfully over AG-UI, while a .NET agent using the standard adapter does not receive that context as part of the model input.

Expected behavior

Please either:

  1. Forward RunAgentInput.Context through the standard .NET adapter as model-visible context, with clear semantics for formatting and trust; or
  2. Document the intended integration point and provide a standard context-provider hook for the .NET SDK.

The implementation should preserve the distinction between untrusted client-provided context and system instructions.

Reproduction

Send an AG-UI run request with a user message and a context entry such as { description: Confirmed writing intent, value: {topic: AI agents, audience: writers} }. Map the request through the standard .NET server adapter and inspect the model request. The user message is present, but no model-visible representation of the context is added unless the application implements custom downstream handling.

Related

This was also reported from the Microsoft Agent Framework integration in microsoft/agent-framework#8740. The protocol-level behavior and the .NET SDK implementation are tracked here because the adapter lives in this repository.

Environment

  • AG-UI specification 1.0
  • AGUI.Server .NET SDK
  • Microsoft Agent Framework integration

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions