sdk-rust
Skill8.2k starsChanged 57 days agoApache-2.0View on GitHub
How to build and extend the Rust server-side SDK in sdks/rust. Read this before changing the client, the generator, sockets, the agent or dispatch, or before adding a dependency.
- Reads credentials
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-dotnetSkill
- sdk-goSkill
- sdk-jsSkill
- sdk-kotlinSkill
- sdk-phpSkill
- sdk-rubySkill
- sdkSkill
- sdk-swiftSkill
- securitySkill
- sttSkill
- telnyxSkill
- ttsSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 1 is distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 22
rustls everywhere, no native-tls: No OpenSSL on the build host, and the same TLS in the HTTP client and the socket.
- Very specific: line 59
Every string enum gets one more variant from the generator (unlisted in generate/src/main.rs): Unlisted(String), #[serde(untagged)], so a …
- Very specific: line 79
Every answer outside 2xx and every refused upgrade goes through Error::refused.
- Very specific: line 139
Run clippy with --workspace --all-targets -- -D warnings, fmt --all --check and run -q -p generate -- --check the same way.
- Very specific: line 149
Test agents use names no real directory has, or Agent::new will find and sync one.
≈ “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
Rust SDK conventions
The per-language half of sdk, server side only. It records the decisions
sdks/rust already follows, so a change lands consistently rather than
re-litigating them.
Edition 2024, MSRV 1.88 (async closures and let chains are used). One crate, vision-agents,
plus the generate binary in the same workspace, which is not published.
Dependencies
tokio, reqwest 0.13 (rustls, json, query), tokio-tungstenite 0.30
(rustls-tls-webpki-roots), serde, thiserror 2, tokio-util (CancellationToken), yaml-rust2
for agent.yaml, md-5 for the folder fingerprint, hmac + sha2 + base64 for JWTs. axum and
tempfile are dev dependencies only.
- rustls everywhere, no native-tls. No OpenSSL on the build host, and the same TLS in the HTTP client and the socket.
- JWTs are signed by hand (
backend::sign), not withjsonwebtoken. HS256 is an HMAC over two base64 segments; the crate would bringringoraws-lcfor the one algorithm used. - No Stream SDK. The official
getstreamcrate (0.1.0-preview.2) hard-depends on libvpx, openh264, opus and a WebRTC stack. The agent needs one endpoint,POST {base}/api/v2/video/call/{type}/{id}?api_key=with a server JWT andStream-Auth-Type: jwt, plus user tokens it can already sign. That isstream.rs. Revisit when a Stream server crate exists without media. - A new dependency is a design question. Ask first.
Generation: typify for types, our own generator for operations
cargo run -p generate reads acceleration/api/openapi.yaml and writes src/types.rs
(typify 0.8) and src/operations.rs (one impl Client method per operation, built with
syn + quote + prettyplease, then rustfmt). Both are committed; -- --check fails when they
are out of date with the spec. lib.rs marks them #[rustfmt::skip] so cargo fmt does not
fight the generator.
Why not the alternatives, researched when the SDK was written:
- progenitor generates a whole client, and its runtime would own auth. Auth here depends
on the credential (customer id, server JWT, user token, the proxy spelling) and the same
headers go on the socket upgrade, which progenitor does not generate. Its
progenitor_client::Errorwould leak into every signature, and responses with more than one success shape come out awkwardly. - openapi-generator (Java) mishandles
allOfand emits a crate of its own with its own reqwest version. - typify alone for types keeps the request layer ours: one
Client::sendthat signs, sends, decodes an empty body asnulland maps a refusal toError::Router. The generated methods are one-line calls into it.
The generator rewrites the spec before typify sees it: OpenAPI nullable becomes a JSON
Schema type union, and schema defaults are dropped, so no default is ever sent that the
caller did not choose (nil means omit, as in every SDK). Structs get Default so a request is
..Default::default().
Every string enum gets one more variant from the generator (unlisted in
generate/src/main.rs): Unlisted(String), #[serde(untagged)], so a value the spec does not
list decodes rather than failing with Error::Decode, and is written back as it came. serde
tries it only after the named variants, so a listed value decodes as before. A router adds
values before every SDK is released (AI-2951: six new session end_reasons), and a rollback
leaves them in stored rows. FromStr and TryFrom stay strict, so a caller who parses a value
gets an error rather than Unlisted. The cost: these enums are not Copy, and a match on
one needs an arm for Unlisted. Integer enums (SessionSortDirection) stay strict. Never
hand-edit the generated files.
Errors
One thiserror enum, vision_agents::Error: Router(Box<RouterFailure>),
Transport, Decode, Socket, Failed{operation, message} (a job or socket that reported
failure), Closed, Configuration (refused before any request), Folder, Io.
Error::status() answers the HTTP status when there is one. A 503 from /health is an error
even though it carries a HealthStatus: a degraded router is not an answer to act on.
RouterFailure (#[non_exhaustive]) is status, operation, and the envelope's message,
kind (its type, a string), code and doc_url, plus request_id from X-Request-Id.
Every answer outside 2xx and every refused upgrade goes through Error::refused. It reads the
generated ErrorResponse (a type the spec does not list yet is ErrorType::Unlisted), or reads
the envelope field by field when it leaves out a field the spec requires. Any other body (a proxy's HTML, the old {"error": "..."}) is trimmed into
the message, or the status line when empty, and the other three fields stay empty. It is boxed
because seven fields inline push every Result past clippy's result_large_err.
Sockets
Hand-written in socket.rs, because OpenAPI stops at the upgrade. Frame is a loosely typed
JSON object (kind, text, flag, number, nested), so a frame this SDK has not heard
of reaches the caller rather than being dropped. Non-JSON text frames are skipped.
- Credentials go on the upgrade as headers, from the same code as HTTP. A refused upgrade
becomes
Error::Routerfrom its envelope and request id, as a refused request does. Frames on an open socket still carry"error": "<string>". - No reconnection.
respondandtool_resultare not idempotent and there is no resume. - Modality sockets send
targetat the top level ofstartas well as in the options block: the router refuses a start frame whose top level names neither a target nor a config.
Sessions answer tool calls themselves
Session::open spawns a watcher that reads the socket, answers tool_call (up to 16 at once,
each its own task) and handles tool_cancel, whether or not anybody calls next_event.
Events are buffered 256 deep, dropping the oldest. A tool's Err goes back as the tool's
error. Output is always sent as a string.
Drop closes the session (cancels the watcher, sends close). within(async |session| ...) is
the scope in place of async with: it closes and waits up to 5s whatever the closure
returned. close() is idempotent.
Agent, folder, dispatch
Agent::new(config)runs a stored config;from_folderloads a directory;namedis an agent with no config. Builders set what the request carries; code wins over config.- The request is built by merging JSON (
overlay), so an unset field is absent, not null. folder.rsis a port of the Go SDK: the same lookup (examples/*/name,agents/name,name, walking up), the same strictagent.yamlkeys, and the same MD5 fingerprint, pinned by a test against the Go value. Changing the hash means changing it in every SDK at once.syncon a folder is onePOST /v1/agents/syncwith the fingerprint, then.agent_sync.Dispatchruns handlers in aJoinSetand drains it on the way out; every call and message ends indonewith itswork_id, carrying anerrorwhen the handler failed or panicked (or there was none).activeandhandlesgo on the handshake. A message with asession_idis answered withanswer, as the server acting for the writer.loadandpingevery 15s.get_or_create_agentkeeps one session per channel and closes them all whenrunends.Dispatch::host(&client, tool_timeout)declares the client'stools()for every agent (host_toolswithevery_agent: true) after everyready, andClient::run_dispatchhosts them alone; it runs eachtool_callin the sameJoinSet, and endsrunwithError::Failedonhosting_refused. Unlike Go, it does not reconnect.Knowledge::add_urlandRouter::transcribe/recordpoll until the job settles.- Speech-to-speech is not wrapped; it is reachable through
Client::socket.
Tests
docker run --rm -v "$REPO":/repo -v va-rust-cargo:/usr/local/cargo/registry \
-v va-rust-rustup:/usr/local/rustup -v va-rust-target:/repo/sdks/rust/target \
-w /repo/sdks/rust rust:1 cargo testRun clippy with --workspace --all-targets -- -D warnings, fmt --all --check and
run -q -p generate -- --check the same way. Named volumes hold the registry and target, so
nothing lands on the host.
- A real in-process axum server (
tests/support), never a mock. It records every request (Seen), answers queued routes, and hands websocket upgrades to the test asAccepted, so a test scripts frames and asserts on what the SDK actually put on the wire. - Assert on outputs, state and what reached the server. Never that a method was called.
StreamApp::with_base_urlpoints call creation at the test server; tokens are checked by verifying the HS256 signature.- Test agents use names no real directory has, or
Agent::newwill find and sync one. tests/live.rsruns only whenVISION_AGENTS_URLis set (optionalVISION_AGENTS_CUSTOMER_ID, defaultexamples). Add--add-host=host.docker.internal:host-gateway,--env-file .envand-e STREAM_ACCELERATION_URL=so the host's value does not win.
Reviewing a change
Reject it if it:
- adds native-tls, a Stream SDK, a JWT crate, or any dependency without asking;
- hand-edits
src/types.rsorsrc/operations.rs, or wraps a single endpoint by hand; - sends a field the caller did not set, or copies a schema default into a request;
- handles a tool call anywhere a caller must be reading events for it to run;
- treats an unknown frame as fatal, or adds reconnection;
- replaces the axum server with a mock, or asserts on calls rather than on the wire.
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.

