Λογότυπο Sdk Ruby

Sdk Ruby

ΟργανισμόςΔημοφιλής
GetStream
sdk-ruby

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.

Επισκόπηση

ΕκδότηςGetStream
ΑποθετήριοAgents
Όνομα δεξιότηταςsdk-ruby
Αστέρια
8.2K
Διακλαδώσεις
709
Συνοδευτικά αρχεία
Μόνο οδηγίες
Άδεια χρήσηςApache-2.0
Σύνδεσμοι
  • Οδηγίες σε Markdown

    Ένα αρχείο SKILL.md που το μοντέλο φορτώνει όταν χρειάζεται, ώστε να καταναλώνει token μόνο όταν ένα αίτημα είναι πράγματι σχετικό.

  • Λειτουργεί με οποιοδήποτε LLM

    Οι δεξιότητες AI είναι απλό Markdown, όχι κώδικας για συγκεκριμένο πάροχο, επομένως αυτή η δεξιότητα λειτουργεί με GPT, Claude, Gemini, Grok ή ένα τοπικό μοντέλο.

  • Αυτοτελής

    Όλα όσα χρειάζεται το μοντέλο περιλαμβάνονται στις οδηγίες — χωρίς επιπλέον αρχεία για συγχρονισμό.

  • Ανοιχτού κώδικα

    Δημοσιεύτηκε στο GitHub από τον λογαριασμό GetStream. Ελέγξτε τα αρχεία της δεξιότητας στο αποθετήριο πριν την εγκαταστήσετε.

Εγκατάσταση

Εγκαταστήστε τη δεξιότητα AI Sdk Ruby στο TypingMind για να τη χρησιμοποιείτε με οποιοδήποτε LLM ή προσθέστε τη σε άλλον πράκτορα AI που διαβάζει αρχεία SKILL.md.

1

Εγκατάσταση στο TypingMind

Το TypingMind εγκαθιστά μια δεξιότητα απευθείας από τον φάκελό της στο GitHub — διαβάζει το SKILL.md, συγκεντρώνει τα συνοδευτικά αρχεία σε πακέτο και αποθηκεύει το αποτέλεσμα τοπικά.

  1. Ανοίξτε την εφαρμογή και μεταβείτε στα Πρόσθετα → Δεξιότητες.
  2. Επιλέξτε «Εγκατάσταση από GitHub».
  3. Επικολλήστε το παρακάτω URL του φακέλου της δεξιότητας και επιβεβαιώστε.
    https://github.com/GetStream/Agents/tree/main/.claude/skills/sdk-ruby
  4. Ενεργοποιήστε τη δεξιότητα σε κάθε συνομιλία όπου θέλετε να είναι διαθέσιμη.
Πρόσθετα → Δεξιότητες → Προσθήκη δεξιότητας → Από URL του GitHub, έπειτα επικολλήστε το URL του φακέλου και πατήστε «Συνέχεια».
2

Εγκατάσταση σε άλλον πράκτορα AI

Κάθε πράκτορας AI που υποστηρίζει τη μορφή Agent Skills μπορεί να χρησιμοποιήσει αυτή τη δεξιότητα — αντιγράψτε τον φάκελο στον κατάλογο δεξιοτήτων του.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/GetStream/Agents.git /tmp/Agents
mkdir -p .claude/skills
cp -r /tmp/Agents/.claude/skills/sdk-ruby .claude/skills/sdk-ruby
Επανεκκινήστε το Claude Code μετά την αντιγραφή, ώστε να εντοπίσει τη νέα δεξιότητα.

Χρησιμοποιήστε τη στο TypingMind

Ενεργοποιήστε τη δεξιότητα Sdk Ruby σε οποιαδήποτε συνομιλία στο TypingMind και το μοντέλο αναλαμβάνει τα υπόλοιπα. Το όνομα και η περιγραφή της περιλαμβάνονται στην προτροπή συστήματος και, μόλις προκύψει ένα σχετικό αίτημα, το μοντέλο φορτώνει μόνο του τις πλήρεις οδηγίες — δεν χρειάζεται ποτέ να την καλείτε χειροκίνητα και δεν καταναλώνει token μέχρι να χρησιμοποιηθεί πραγματικά.

Το μοντέλο φορτώνει αυτόματα τη δεξιότητα Sdk Ruby μόλις λάβει ένα σχετικό αίτημα.

Λειτουργεί με οποιοδήποτε μοντέλο AI

Οι δεξιότητες AI είναι οδηγίες σε απλό κείμενο Markdown και όχι κώδικας για συγκεκριμένο πάροχο, οπότε η δεξιότητα Sdk Ruby δεν περιορίζεται στο μοντέλο για το οποίο γράφτηκε. Εγκαταστήστε τη μία φορά στο TypingMind και χρησιμοποιήστε τη με GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ή ένα τοπικό μοντέλο που εκτελείτε εσείς — πάντα με τα δικά σας κλειδιά API.

  • Φόρτωση μόνο όταν χρειάζεται

    Η προτροπή συστήματος περιλαμβάνει μόνο το όνομα και την περιγραφή. Οι οδηγίες ανακτώνται με το πρώτο σχετικό αίτημα, οπότε μια δεξιότητα που δεν χρησιμοποιείται δεν έχει κόστος.

  • Αλλάξτε μοντέλο κατά τη διάρκεια της συνομιλίας

    Επειδή η δεξιότητα αποτελείται από οδηγίες και όχι από κώδικα, η αλλαγή μοντέλου δεν επηρεάζει τη λειτουργία της — το επόμενο μοντέλο διαβάζει το ίδιο αρχείο SKILL.md.

Οδηγίες δεξιότητας

Αυτό είναι το περιεχόμενο του αρχείου SKILL.md που φορτώνει το μοντέλο. Διαβάστε το πριν από την εγκατάσταση — μια δεξιότητα αποτελείται από οδηγίες που θα ακολουθήσει το μοντέλο σας.

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, search

Dependencies

Two at runtime, and adding a third needs a reason written here.

  • getstream-ruby ~> 12.1, Stream's server-side gem, only in edge.rb's create_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 in Backend.sign.
  • websocket-driver ~> 0.8: the protocol only. The connection, TLS, reader thread and lifecycle are ours in Socket. Not faye-websocket (wants EventMachine), not async-websocket (a fiber stack the rest of the gem does not use), not websocket-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::HMAC plus unpadded URL-safe base64, because the gem only issues one kind of HS256 token and never verifies one. Reach for jwt ~> 3.3 if that ever changes.
  • JSON is json, YAML is Psych.safe_load(text, aliases: false). Never YAML.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).

bash
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_call on its own thread per call, at most 16 at once, with the slot taken before the thread starts. tool_cancel drops 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. capacity bounds 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 to memory.user_id; everything else to memory.filter, as strings. cost_tracking goes to tags on the session, on placeCall, and on sync.
  • Agent#sync ports Go's Hash/fingerprint byte for byte (Folder.fingerprint); the fixture in folder_test.rb pins 02a7b2c8428f31e3a2b93ca2f5a6ec70. With a subagent or cost labels set the hash is re-fingerprinted with map[k:v ...], which is how Go's fmt.Sprint writes a map. A matching .agent_sync reads the config back instead of posting.
  • A session owns its call, agent:<session id>: nothing here names or creates one. join opens the session with start_voice: true, chat opens it in writing, and session.voice.start/stop move it between the two (POST/DELETE /v1/agents/sessions/{id}/voice). Voice is on when the session answered a call_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) with start_voice, navigating: true and phone.vendor_call_id. In that order.
  • An InboundCall opens the session_id its dispatch frame names, with voice and phone.number set to the number rung; one naming no session is refused.
  • Rewind is 204 and refused with 400 on a persisted conversation; fork with response_id instead. A response id is not the turn_id socket frames carry.
  • Dispatch ping.at is a number the router echoes, not a timestamp.
  • A modality stream's start frame needs a top-level target or config_id; the router does not read the block's target, so Router#open lifts 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.

bash
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, never a stored API key: .github/workflows/release-sdk-ruby.yml, run by hand or with every other SDK (see the release-sdks skill). Not rubygems/release-gem, whose rake release tags v<version>, the Python packages' tag. 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 where Client#get would 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 respond or tool_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.

Συχνές ερωτήσεις

Τι κάνει η δεξιότητα AI Sdk Ruby;

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.

Γιατί να χρησιμοποιήσετε τη δεξιότητα Sdk Ruby στο TypingMind;

Επειδή την εγκαθιστάτε μία φορά και τη χρησιμοποιείτε με οποιοδήποτε μοντέλο. Η Sdk Ruby είναι απλό Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως η ίδια δεξιότητα λειτουργεί με GPT-5, Claude, Gemini, Grok ή ένα τοπικό μοντέλο — και μπορείτε να αλλάξετε μοντέλο κατά τη διάρκεια της συνομιλίας χωρίς να διακοπεί η λειτουργία της. Το TypingMind λειτουργεί με τα δικά σας κλειδιά API, οπότε πληρώνετε απευθείας τους παρόχους αντί για συνδρομή ανά θέση χρήστη, ενώ οι δεξιότητες και οι συνομιλίες σας παραμένουν στον δικό σας χώρο αποθήκευσης.

Πώς εγκαθιστώ τη δεξιότητα Sdk Ruby στο TypingMind;

Στο TypingMind, ανοίξτε Πρόσθετα → Δεξιότητες → Εγκατάσταση από το GitHub και επικολλήστε τη διεύθυνση https://github.com/GetStream/Agents/tree/main/.claude/skills/sdk-ruby. Το TypingMind διαβάζει το αρχείο SKILL.md και εγκαθιστά τη δεξιότητα, την οποία μπορείτε να ενεργοποιείτε ανά συνομιλία.

Ποια μοντέλα AI μπορούν να χρησιμοποιήσουν τη δεξιότητα Sdk Ruby;

Οποιοδήποτε μοντέλο συνδέετε στο TypingMind. Οι δεξιότητες AI είναι απλές οδηγίες Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως τα GPT, Claude, Gemini, Grok και τα τοπικά μοντέλα μπορούν όλα να φορτώσουν αυτή τη δεξιότητα όταν ένα αίτημα αντιστοιχεί σε αυτή.

Με πόσα μοντέλα AI μπορώ να χρησιμοποιήσω τη δεξιότητα Sdk Ruby;

Με όσα θέλετε. Στο TypingMind μπορείτε να χρησιμοποιήσετε τη δεξιότητα Sdk Ruby με οποιοδήποτε μοντέλο υποστηρίζει δεξιότητες, όπως τα GPT, Claude, Gemini, Grok, DeepSeek, Mistral και Llama, χρησιμοποιώντας τα δικά σας κλειδιά API.

Είναι δωρεάν η δεξιότητα AI Sdk Ruby;

Ναι. Δημοσιεύεται στο GitHub από τον λογαριασμό GetStream με την άδεια χρήσης Apache-2.0. Πληρώνετε μόνο τον δικό σας πάροχο AI για τα token που χρησιμοποιείτε.

Τι είναι οι δεξιότητες AI;

Μια δεξιότητα AI είναι ένα επαναχρησιμοποιήσιμο πακέτο οδηγιών που διδάσκει σε ένα μοντέλο AI πώς να εκτελεί μια συγκεκριμένη εργασία. Ακολουθεί την ανοιχτή μορφή Agent Skills: ένα αρχείο SKILL.md με όνομα και περιγραφή, μαζί με τυχόν σενάρια κώδικα, πρότυπα ή αρχεία αναφοράς που μπορεί να χρειαστεί το μοντέλο. Το μοντέλο διαβάζει τις οδηγίες μόνο όταν το αίτημά σας αντιστοιχεί στη δεξιότητα, οπότε μια εγκατεστημένη δεξιότητα δεν κοστίζει τίποτα μέχρι να χρησιμοποιηθεί.

Σε τι διαφέρουν οι δεξιότητες AI από τα πρόσθετα ή τους συνδέσμους MCP;

Ένα πρόσθετο ή ένας σύνδεσμος MCP παρέχει στο μοντέλο νέα εργαλεία που μπορεί να καλέσει — κώδικα που εκτελείται κάπου και επιστρέφει ένα αποτέλεσμα. Μια δεξιότητα AI παρέχει αντί γι’ αυτό γνώσεις και διαδικασίες στο μοντέλο: πώς να προσεγγίσει μια εργασία, ποια βήματα να ακολουθήσει και ποια χαρακτηριστικά έχει ένα καλό αποτέλεσμα. Οι δεξιότητες είναι απλό Markdown, επομένως δεν χρειάζονται διακομιστή, κλειδί API ή περιβάλλον εκτέλεσης και λειτουργούν με οποιοδήποτε μοντέλο.

Προβολή όλων

Δημιουργήστε τώρα τον δικό σας χώρο εργασίας AI

Εγγραφείτε στο ενημερωτικό μας δελτίο για να ενημερώνεστε για νέες λειτουργίες και μελλοντικές κληρώσεις δώρων 👇