sdk-dotnet
Skill8.2k starsChanged 57 days agoApache-2.0View on GitHub
How to build and extend the .NET SDK in sdks/dotnet. Read this before changing the client, the socket, the agent, dispatch or the router, before regenerating the models, or before reaching for a NuGet package.
Adopted by
Steady: 0 new projects took it in the last 4 weeks, none the 4 weeks before.thin data
Who's talking about GetStream/Agents
- sudosubin/agents.nix“agent-skills.github.getstream.agents: 0.6.404 → 0.6.405”GitHub · Nov 30, 2026
- sudosubin/agents.nix“agent-skills.github.getstream.agents: 0.6.403 → 0.6.404”GitHub · Nov 30, 2026
- sudosubin/agents.nix“agent-skills.github.getstream.agents: 0.6.402 → 0.6.403”GitHub · Nov 29, 2026
- sudosubin/agents.nix“agent-skills.github.getstream.agents: 0.6.399 → 0.6.402”GitHub · Nov 27, 2026
- sudosubin/agents.nix“agent-skills.github.getstream.agents: 0.7.1 → 0.6.399”GitHub · Nov 27, 2026
The biggest 5 of 8 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 8
Talked about on GitHub (8 times).
On GitHub · 8
- Nov 30, 2026agent-skills.github.getstream.agents: 0.6.404 → 0.6.405 — sudosubin/agents.nix0 reactions
- Nov 30, 2026agent-skills.github.getstream.agents: 0.6.403 → 0.6.404 — sudosubin/agents.nix0 reactions
- Nov 29, 2026agent-skills.github.getstream.agents: 0.6.402 → 0.6.403 — sudosubin/agents.nix0 reactions
- Nov 27, 2026agent-skills.github.getstream.agents: 0.6.399 → 0.6.402 — sudosubin/agents.nix0 reactions
- Nov 27, 2026agent-skills.github.getstream.agents: 0.7.1 → 0.6.399 — sudosubin/agents.nix0 reactions
3 more on GitHub
- Nov 25, 2026fix: retain 7 reviewed references that left discovery (Nov 25) — tekvisions/voice-index0 reactions
- Nov 24, 2026agent-skills.github.getstream.agents: 0.7.0 → 0.7.1 — sudosubin/agents.nix0 reactions
- Nov 17, 2026agent-skills.github.getstream.agents: init at 0.7.0 — sudosubin/agents.nix0 reactions
In this repository55 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/python.mdcCursor rule
- pr-reviewSkill
- typesafe-aiSkill
- vgpuSkill
- accelerate-sales-engineerSkill
- add-connectorSkill
- check_pricesSkill
- cliSkill
- commitSkill
- connectorsSkill
- dashboardSkill
- decision_modelSkill
- deploySkill
- docsSkill
- generative-uiSkill
- good_morningSkill
- goSkill
- go-testingSkill
- integrate_new_modelsSkill
- llm-interfaceSkill
- loop_performance_benchSkill
- migrate-to-accelerateSkill
- new_modelsSkill
- paginationSkill
- parallel-agentsSkill
- performance_benchmarkSkill
- phonecheckSkill
- pricingSkill
- prospect-competitor-researchSkill
- provider_auditSkill
- prSkill
- querySkill
- refresh_model_statsSkill
- router-detectionSkill
- router-interfaceSkill
- router-llmSkill
- router-searchSkill
- router-stsSkill
- router-sttSkill
- router-ttsSkill
- scheduled-tasksSkill
- sdk-dartSkill
- sdk-goSkill
- sdk-jsSkill
- sdk-kotlinSkill
- sdk-phpSkill
- sdk-rubySkill
- sdk-rustSkill
- sdkSkill
- sdk-swiftSkill
- securitySkill
- sttSkill
- telnyxSkill
- ttsSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 0 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 82
Never hand-edit Generated/Models.cs.
- Very specific: line 105
Every answer that is not a success becomes a RouterException in one place, RouterException.Answered, which reads the generated …
- Very specific: line 125
No automatic reconnection on session sockets: respond and tool_result are not idempotent.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
.NET SDK conventions
The per-language half of sdk. It records the decisions
sdks/dotnet already follows, so a change lands consistently rather
than re-litigating them.
Assume .NET 10 (the LTS), C# 14, net10.0, nullable reference types on, warnings as errors,
central package management (Directory.Packages.props). Server side only.
Toolchain: Docker, never the host
Nothing is installed on the host. Every command runs in mcr.microsoft.com/dotnet/sdk:10.0
with the repo mounted and the NuGet cache in the va-nuget volume:
D="docker run --rm -v /path/to/Vision-Agents:/repo -v va-nuget:/root/.nuget -w /repo/sdks/dotnet mcr.microsoft.com/dotnet/sdk:10.0"
$D dotnet build GetStream.VisionAgents.slnx
$D dotnet test --project tests/GetStream.VisionAgents.Tests
$D dotnet run --project tools/Generate # regenerate the models
$D dotnet run --project tools/Generate -- --check # what CI runs
docker run ... -e VISION_AGENTS_LIVE_URL=http://host.docker.internal:8091 ... \
dotnet test --project tests/GetStream.VisionAgents.Tests -- --filter-class GetStream.VisionAgents.Tests.LiveTestsBuild output (bin/, obj/, TestResults/) is ignored by sdks/dotnet/.gitignore, nowhere
else.
Naming
Stream's .NET packages are getstream-net (the current generated server SDK, namespace
GetStream), stream-chat-net and stream-feed-net. The package id is the placeholder
getstream-calypso, like the JS @stream-io/calypso, until the public name is chosen; the
namespace stays GetStream.VisionAgents, with the generated DTOs under
GetStream.VisionAgents.Models.
Releases run by hand: Actions, "Release .NET SDK", "Use workflow from" main, pick the
part to bump or type an exact version, and untick the dry run to publish. The workflow is
.github/workflows/release-sdk-dotnet.yml; it pushes to NuGet through trusted publishing and
tags sdk-dotnet-v<version>. Keep the file name: the nuget.org policy is bound to it. Do not rename to StreamIO.*; nothing
Stream ships to NuGet is called that.
Public types are named after what they are to a caller (Agent, Session, Dispatch,
Router, Folder), async methods end in Async and take a CancellationToken last,
defaulted. Options are sealed records with init properties.
The generator: NSwag, DTOs only
tools/Generate uses NSwag 14.7.1 as a library, writing
src/GetStream.VisionAgents/Generated/Models.cs. The output is committed, so a restore needs no
code generation, and --check fails CI when the spec has moved without it.
Why NSwag, and why DTOs only:
- The request layer has to be ours. A token is minted per request, a local router takes
X-Customer-Id, a hosted one wantsapi_keyandstream-auth-type, and sockets carry the same credential. A generated client brings a runtime that decides those things, and it decides them differently. So the generator emits POCOs andVisionAgentsClienthas one method per HTTP verb (GetAsync<T>,PostAsync<T>, ...), the way sdk-js does. - Kiota was the other serious option. It generates request builders over its own
abstractions (
Microsoft.Kiota.*packages at runtime), its models are not plainSystem.Text.Jsontypes, and it cannot be told to emit models alone. That is a runtime dependency and an auth pipeline to fight for types we only need the shapes of. - openapi-generator needs a JVM, emits an
ApiClient/Configurationruntime, and itsSystem.Text.Jsonpath is the less-travelled one. - Refitter generates Refit interfaces, so Refit at runtime, for the same reason no.
- NSwag emits
System.Text.JsonPOCOs with nullable reference types, runs on the same .NET image, and is pinned inDirectory.Packages.props. The library rather than the CLI because the CLI cannot be told two things that make the output usable: PascalCase property names (PascalCaseNames) and enums as strings (EnumsAsStrings). A C# enum has nowhere to put a value the router adds after this ships, so an enum would fail the whole response; the values stay in the doc comment. GenerateDefaultValues = falseand optional properties nullable: never copy a schema default into a request. A default sent because the type had one is how a caller silently loses what their config named. A field left null is left out, so the config or the router decides.
Never hand-edit Generated/Models.cs. Never re-declare a schema by hand; use the model.
Dependencies
- getstream-net 16.0.1 for what is Stream rather than this router:
Edgemints user tokens (CreateUserToken) and can still create a call (VideoClient.GetOrCreateCallAsync), though agents no longer need one created: the router names it after the session. It refuses a secret shorter than 256 bits, which a real Stream secret never is; test fixtures use a 64-character one. Its exceptions are wrapped inRouterException. - YamlDotNet 18.1.0 for
agent.yaml,urls.yamland skill frontmatter, with duplicate keys refused. A keyagent.yamldoes not know is refused, not dropped. - Tokens for the router itself are HS256 signed with
System.Security.Cryptography, not a JWT package: a dozen lines inBackend.SignToken. - Nothing else at runtime. A new package is a design question; ask first.
HttpClient
new VisionAgentsClient(options) owns its HttpClient; new VisionAgentsClient(httpClient,
options) borrows one, which is how IHttpClientFactory plugs in, and never disposes it.
Agent disposes a client only if it made it. Do not add a DI extension package.
Errors
Every answer that is not a success becomes a RouterException in one place,
RouterException.Answered, which reads the generated ErrorResponse: Said is its message,
Type (a string, so a kind the router adds later still reads) and Code are what to branch on,
DocUrl explains the code, and RequestId is the X-Request-Id to quote when a 500 says only
"something went wrong". A body that is not the envelope (a proxy's page, nothing, an older
router's {"error": "..."}) keeps its trimmed text as Said with the rest null, and a refused
socket upgrade has no body at all, because ClientWebSocket keeps only the status and headers.
Sockets
Hand-written in Socket.cs, because OpenAPI stops at the upgrade. One Socket over
ClientWebSocket for the session events, dispatch and the modality streams.
- Server side, so credentials go in headers, never the query string.
- Frames are loose (
Frame, read throughText,Flag,Number,Nested), so a frame type the router learns later reaches a caller rather than being dropped. - The modality start frame carries
targetat the top level as well as inside the option block, like Go and the Python plugin: the router refuses a frame whose target is only in the block (seereadStartinacceleration/internal/api/streamws.go), although the spec describes only the block. - No automatic reconnection on session sockets:
respondandtool_resultare not idempotent.Dispatchredials its own socket (see below).
Sessions and tools
- The watch loop starts when the session opens and handles
tool_callandtool_cancelitself, so a tool runs whether or not anybody iteratesEventsAsync. At most 16 run at once; a tool that throws is answered with its message, because the model is mid-sentence waiting. EventsAsynchas one reader over a bounded 256-slot channel that drops the oldest.CloseAsyncsendscloseover an open socket, else DELETEs the session; a 404 is fine.- Rewinding a conversation kept in Stream Chat is refused by the router (400, "fork it at the
response");
ForkAsync(new ForkOptions { ResponseId = ... })is the way.
Agent and folder
- Sessions own their call,
agent:<session id>.JoinAsyncopens one withstart_voice;JoinAsync(InboundCall)opens the session the call names, with voice;ChatAsyncsends nostart_voice;Session.Voicestarts and stops it later.OutboundCallAsyncplaces the call first, then joins the session it returns withnavigating;WaitForCallAsyncattaches the number, waits on a one-callDispatchfor the router to hand a call over, joins it and returns once somebody speaks.ResumeAsync(id)reads a session and watches it. - Instructions reach the backend only through
SyncAsync; nothing sends them per session. Configis a directory holdingagent.yamlor a stored config's name;ConfigIdis a stored config by id, which is what a dispatched message carries. Naming both is refused.- What code sets wins over what the directory says.
SyncAsyncis onePOST /v1/agents/sync. The fingerprint is MD5, ported byte for byte from Go (Folder.Fingerprint,Folder.GoMapfor Go's%vof a map), so.agent_syncwritten by Go or Python is read back here. The fixture hash02a7b2c8428f31e3a2b93ca2f5a6ec70is pinned inFolderTests; if it changes, Go changed first or this is wrong. The stamp is written with relaxed escaping, sinceSystem.Text.Jsonwould otherwise write the+of the offset as\u002B.
Dispatch
- Handlers run off the read loop in
Task.Run, tracked by id in aConcurrentDictionarywhose entry is removed before the tracking task completes, soActiveis exact onceRunAsynchas drained. RunAsyncreturns quietly when cancelled, even during connect, then drains work in flight and closes the agents it made. Dropping work would hang up on whoever is talking.GetOrCreateAgentAsynckeeps one agent per channel while its session is live, and opens chats with the message'sAgentId, as Go and Python do.Host(client, toolTimeout)sendshost_toolsforclient.Toolswithevery_agent: trueafter everyready;client.RunDispatchAsync()hosts them alone. Hosted calls are tracked work like calls, andhosting_refusedthrows out ofRunAsync. A connection that ends without a normal close is redialled with backoff (1s doubling to 30s), as in Go. This is the one socket that reconnects: dispatch frames belong to one connection.
Tests
xUnit v3 (4.0.1) on the Microsoft Testing Platform (global.json sets the runner), because
.NET 10's dotnet test no longer drives VSTest here. Never mock.
TestRouteris a real Kestrel server on loopback port 0 with real WebSocket upgrades. It records what arrived and lets a test script frames. Assert on what reached the far end.- Getstream-net is pointed at the same server through
EdgeOptions.BaseUrl, so a test can assert that no Stream call is created. LiveTestsskip unlessVISION_AGENTS_LIVE_URLis set. They hold real conversations and wait for what the router writes behind a request instead of sleeping.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

