Prepare the runtime
The Agent SDK package is not yet on NuGet. Follow the source installation instructions.
Quickstart
What it ships
AgentSdk.CreateAgent(...)
AgentSdk.DefineTool(...)
AgentSdk.CreateGatewayAgentClient(...)
- a bounded tool loop over the Phaseo
responses API
Advanced runtime
C# supports validation and approval delegates, HITL and manual tools, progress, recoverable errors, replayable async enumerables, stop helpers, dynamic turns, persisted NextTurnParams, normalized usage/cost, and IStateAccessor.
Streaming and cancellation
Agent.Stream(...) and Agent.ContinueStream(...) use IAsyncEnumerable over the gateway’s Responses SSE stream. Consume TextStream() or FullStream(), and call Cancel() to cancel the linked request token. Completed steps retain request IDs, provider metadata, finish reasons, warnings, usage, and cost.
Last modified on July 26, 2026