---
title: "C#/.NET SDK Code Agent SDK"
source: https://docs.autohand.ai/agent-sdk/csharp
---

# C#/.NET SDK

The .NET SDK wraps the Autohand CLI subprocess and exposes async APIs for agent runs, event streams, permissions, structured output, and cancellation-aware host code.

**Repository:** [autohandai/code-agent-sdk-csharp](https://github.com/autohandai/code-agent-sdk-csharp). This SDK is in beta while the Agent SDK APIs stabilize. Pin commits or package versions in production.

## Requirements

-   .NET 8 or newer.
-   Autohand CLI installed, authenticated, and configured.
-   Optional \`AUTOHAND\_CLI\_PATH\` when testing a local CLI build.

## Install

## Run your first agent

Start with the high-level agent API when you want the SDK to own the run lifecycle and final result collection.

## API shape

-   \`Agent\` and \`Run\` for high-level application workflows.
-   \`AutohandSdk\` for low-level JSON-RPC control.
-   \`IAsyncEnumerable<SdkEvent>\` for streaming tokens, tools, permission requests, and errors.
-   \`CancellationToken\` and \`await using\` support for host-managed lifecycle.

## Structured JSON

Use \`RunJsonAsync<T>\` when your app needs typed output instead of prose.

## Next steps

-   Use [Quickstart](quickstart.html) for the cross-language setup flow.
-   Open [C#/.NET API](csharp-api.html) for the reference surface.
-   Read [Stream responses in real-time](io/streaming.html) and [Handle approvals and user input](io/approvals.html) for shared runtime behavior.