sdk-ruby
Skill8.2k starsChanged 56 days agoApache-2.0View on GitHub
How to build and extend the Ruby SDK in sdks/ruby. Read this before changing the client, the sockets, the agent, dispatch, folder sync or the router, or before reaching for a gem.
Trending
More talk lately.thin dataabout the whole repository
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-rustSkill
- sdkSkill
- sdk-swiftSkill
- securitySkill
- sttSkill
- telnyxSkill
- ttsSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 1 is distinctive, and 5 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.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 66
Not OpenAPI Generator's ruby client: it produces a model class per schema and a Faraday client, neither of which the socket protocols, …
- Distinctive: line 83
Never copy a schema default into a request.
- Very specific: line 102
No reconnection, on purpose: respond and tool_result are not idempotent and the protocol has no sequence number to resume from.
- Very specific: line 112
Every refusal, an HTTP answer or a refused upgrade, is read by RouterError.answered: error.message is the message, with type, code (branch …
- Very specific: line 157
Wait with a deadline (eventually, receive(timeout:)), never a bare sleep guess.
- Very specific: line 170
Run from the repo root. The full image, not -slim: websocket-driver has a C extension.
≈ “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
Ruby SDK conventions
The per-language half of sdk. It records the decisions
sdks/ruby already follows, so a change lands consistently rather than
re-litigating them. Server side only: there is no Ruby client for devices.
Ruby 3.3 or newer (3.2 is end of life; 3.3 gets security fixes only), built and tested in the
official ruby:4.0 image. Never install gems on the host.
The gem
One gem, getstream-vision-agents, require "getstream/vision_agents", module
GetStream::VisionAgents. Stream's own gems are getstream-ruby (GetStreamRuby::Client,
generated code under GetStream::), stream-chat-ruby (maintenance mode) and stream-ruby;
the name sits beside the current one without claiming its namespace.
lib/getstream-vision-agents.rb exists only so Bundler.require finds it.
lib/getstream/vision_agents.rb requires everything, in order
generated/spec.rb OPERATIONS and SCHEMAS, from the spec. Never edit
backend.rb client.rb who is calling; one method per HTTP verb
socket.rb TCP/TLS + websocket-driver, one reader thread
session.rb tools.rb responses.rb a conversation, its tools, its turns
agent.rb folder.rb knowledge.rb Agent, Sessions, Sandbox; agent.yaml and .agent_sync
inbound.rb dispatch.rb edge.rb dispatch frames, the worker, Stream calls
router.rb Router, the four realtime streams, recordings, searchDependencies
Two at runtime, and adding a third needs a reason written here.
getstream-ruby ~> 12.1, Stream's server-side gem, only inedge.rb'screate_call(client.video.get_or_create_call), for a caller that wants a Stream call of its own; an agent's session names its call itself. It pulls in Faraday; that is the price of using Stream's client rather than re-implementing call creation. It has no public user-token method, so tokens are signed inBackend.sign.websocket-driver ~> 0.8: the protocol only. The connection, TLS, reader thread and lifecycle are ours inSocket. Notfaye-websocket(wants EventMachine), notasync-websocket(a fiber stack the rest of the gem does not use), notwebsocket-client-simple(four more gems, callbacks on its own thread). Never frame websockets by hand.
What is not a dependency, and why:
- HTTP is
Net::HTTP, as Stripe's gem does. The router is one host with JSON bodies; Faraday's middleware buys nothing here and its adapters are a support matrix. - JWT is
OpenSSL::HMACplus unpadded URL-safe base64, because the gem only issues one kind of HS256 token and never verifies one. Reach forjwt ~> 3.3if that ever changes. - JSON is
json, YAML isPsych.safe_load(text, aliases: false). NeverYAML.load.
Generated from the spec, not a generated client
script/generate reads acceleration/api/openapi.yaml and writes
lib/getstream/vision_agents/generated/spec.rb: every operation's method, path, path and
query parameters, body schema, whether it is a socket, and every object schema's property
names. Client#get/post/put/patch/delete(template, path:, query:, body:) look the template up
there, so a path, query key or body key the spec lacks is refused before a request is made,
and every operation is callable the day the spec gains it.
Not OpenAPI Generator's ruby client: it produces a model class per schema and a Faraday
client, neither of which the socket protocols, dispatch or folder sync can use, and Stream's
own getstream-ruby is made by an internal generator rather than that one. Answers stay
string-keyed hashes, whole, so a field added after the gem shipped still reaches the caller.
Data.define only for small values the gem constructs itself (Participant, Event,
InboundMessage, Skill, Audio).
docker run --rm -v "$PWD:/repo" -v va-ruby-bundle:/usr/local/bundle -w /repo/sdks/ruby ruby:4.0 \
sh -c "bundle install && ruby script/generate"rake check (part of the default task) fails when the committed table is stale. The router
option blocks (SttOptions, TtsOptions, LlmOptions, StsOptions, SearchOptions) are
checked against the same table.
nil means omit, everywhere: a key left nil is left out so the config or the router decides.
Never copy a schema default into a request.
Concurrency
Threads, not fibers. One reader thread per socket; it never runs user code.
- A session answers
tool_callon its own thread per call, at most 16 at once, with the slot taken before the thread starts.tool_canceldrops the answer; a Ruby thread cannot be killed safely, so the tool finishes and its result is not sent. - Events are buffered, 256 deep, oldest dropped. Answering tools never depends on anybody
reading
events. - Dispatch runs each call and message handler on its own thread.
capacitybounds it: the router does not hand a full worker more work. - Writes to a socket are serialised; the driver is only touched under its lock.
The Ruby spelling of async with is a block with ensure: agent.join(call) { |session| },
agent.chat { }, router.stt.realtime { } close on every exit path and return the block's
value. Without a block the open object is returned and closing it is the caller's job.
No reconnection, on purpose: respond and tool_result are not idempotent and the protocol
has no sequence number to resume from. A socket that drops ends the session or Dispatch#run.
Errors
Error < StandardError; ConfigurationError for anything refused before a request is made;
RouterError with status (0 means it never arrived), operation (the spec's operation id),
body and retry_after; SocketClosedError for writing to a closed socket. A refused
websocket upgrade is a RouterError with the handshake's status. Never rescue Exception.
Every refusal, an HTTP answer or a refused upgrade, is read by RouterError.answered:
error.message is the message, with type, code (branch on it; it may be new) and doc_url
beside it, all nil for a body that is not the envelope, whose trimmed text is the message
instead. request_id is the X-Request-Id header, what a 500 is quoted to support by; for a
refused upgrade Socket keeps the bytes after the head up to Content-Length, since
websocket-driver reads only the status and the headers.
Behaviour that is easy to get wrong
- The session request carries
agent:(the config name) and only what the code set. The stored config decides the rest. memory_filter[:user_id]goes tomemory.user_id; everything else tomemory.filter, as strings.cost_trackinggoes totagson the session, onplaceCall, and on sync.Agent#syncports Go'sHash/fingerprintbyte for byte (Folder.fingerprint); the fixture infolder_test.rbpins02a7b2c8428f31e3a2b93ca2f5a6ec70. With a subagent or cost labels set the hash is re-fingerprinted withmap[k:v ...], which is how Go'sfmt.Sprintwrites a map. A matching.agent_syncreads the config back instead of posting.- A session owns its call,
agent:<session id>: nothing here names or creates one.joinopens the session withstart_voice: true,chatopens it in writing, andsession.voice.start/stopmove it between the two (POST/DELETE /v1/agents/sessions/{id}/voice). Voice is on when the session answered acall_id.sessions.resume(id)gets a session and watches it. A fork is always held in writing. - Instructions reach the backend only through
sync; no session request or socket frame carries them. - Outbound:
POST /v1/phone/calls, then open the session it answers (session_id) withstart_voice,navigating: trueandphone.vendor_call_id. In that order. - An
InboundCallopens thesession_idits dispatch frame names, with voice andphone.numberset to the number rung; one naming no session is refused. - Rewind is 204 and refused with 400 on a persisted conversation; fork with
response_idinstead. A response id is not theturn_idsocket frames carry. - Dispatch
ping.atis a number the router echoes, not a timestamp. - A modality stream's start frame needs a top-level
targetorconfig_id; the router does not read the block'starget, soRouter#openlifts it.
Tests
Minitest, rake test. Never mock and never assert that a method was called; assert on what
reached the wire and what came back.
test/support/local_router.rb is a real server on 127.0.0.1:0: a TCPServer that parses
HTTP, answers scripted routes, records every request, and upgrades websockets with
WebSocket::Driver.server so a test can script frames and read what the client sent. Not
WEBrick (a dev dependency that cannot hand over the socket for an upgrade). getstream-ruby
is pointed at the same server with base_url:, so creating a call is tested too.
Wait with a deadline (eventually, receive(timeout:)), never a bare sleep guess.
The live suite, test/live, runs with rake live and skips unless VISION_AGENTS_URL is
set (customer VISION_AGENTS_CUSTOMER_ID, default examples). From Docker the local router
is http://host.docker.internal:8091. It holds real conversations and spends tokens.
docker run --rm -v "$PWD:/repo" -v va-ruby-bundle:/usr/local/bundle -w /repo/sdks/ruby ruby:4.0 \
sh -c "bundle install && bundle exec rake"
docker run --rm -v "$PWD:/repo" -v va-ruby-bundle:/usr/local/bundle -w /repo/sdks/ruby \
-e VISION_AGENTS_URL=http://host.docker.internal:8091 ruby:4.0 sh -c "bundle install && bundle exec rake live"Run from the repo root. The full image, not -slim: websocket-driver has a C extension.
Publishing
rubygems_mfa_required is set in the gemspec. Publish with RubyGems trusted publishing from
CI (rubygems/release-gem), never a stored API key. Gemfile.lock is not committed for a
library.
Reviewing a change
Reject it if it:
- hand-edits
generated/spec.rb, or adds a per-endpoint method whereClient#getwould do; - adds a runtime gem without a reason here, or reaches for Faraday outside
edge.rb; - runs user code on a socket's reader thread, or opens a second reader on one socket;
- replays
respondortool_result, or reconnects a session socket; - sends a schema default, or a key the code did not set;
- symbolises wire hashes, or drops a frame kind it does not know;
- changes the folder fingerprint without the pinned hash still passing;
- uses
YAML.load,rescue Exception, or a mock.
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.

