Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .claude/skills/connectors/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,14 @@ For a session your backend creates, pass the end user's connection in
`connector_bindings: [{"name": "linear", "connection_id": "…"}]`. Leave it out and the
router uses the user's only connected connection to that connector, if there is exactly one.

`agent.yaml`: the sync API accepts `connectors`, and the Go SDK folder reader reads the block
(`sdks/go/agents/config.go`, `connectorBindings`). An entry whose `connection:` the app does not have
is left out with a warning, and the rest of the agent syncs; `required: true` makes it an error. `sandbox: true` lets code in the session's sandbox call the connector's API with the binding's connection.
The left-out entries go to the router as `left_out_connectors` and are served on the agent config.
Other SDKs: unverified, check `git grep connectors sdks/js/src plugins/stream` before relying on it.
`agent.yaml`: a sync that sends the directory's files (Go and JavaScript do) has its `connectors`
block read by the router (`acceleration/internal/api/directory.go`, `bindDirectoryConnectors`),
which finds a `connection:` among the app's own by id or by label. An entry whose connection the
app does not have is left out with a warning, stored as `left_out_connectors` and served on the
agent config, and the rest of the agent syncs; `required: true` makes it an error. `sandbox: true`
lets code in the session's sandbox call the connector's API with the binding's connection.
An SDK that still reads the folder itself sends `connectors` and `left_out_connectors` as fields:
check `git grep connectors plugins/stream` before relying on one.

### Sandbox access

Expand Down
37 changes: 22 additions & 15 deletions .claude/skills/generative-ui/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,13 @@ model tokens

## The agent.yaml `ui:` key

`ui:` tells the model what it may draw. The SDK that loads the folder compiles it into a
`## Interactive UI Generation` section and syncs it as the config's `ui_instructions`, apart from
`instructions.md`, so the router sees only text. The output is deterministic, so the prompt
`ui:` tells the model what it may draw. It is compiled into a `## Interactive UI Generation`
section stored as the config's `ui_instructions`, apart from `instructions.md`. For a sync of the
directory's files (`POST /v1/agents/sync/files`, which Go and JavaScript send) the router compiles
it (`acceleration/internal/agentdir/ui.go`) and keeps the key and the two files beside it
(`agent_configs.ui_source`), which `GET /v1/agents/configs/{id}/directory` writes back until
somebody writes other `ui_instructions`. An SDK that still syncs the fields it read compiles it
and sends the text. The output is deterministic, so the prompt
prefix stays cacheable across turns. The prompt is mixed mode: the model answers in prose and
adds a card only when it helps.

Expand Down Expand Up @@ -68,17 +72,19 @@ ui:
Paths are relative to the agent directory and may not leave it (symlinks included); each file is
capped at 512 KiB.

Loaded by: Go (`sdks/go/agents/ui.go`, from `Load`, into `Folder.UIInstructions`) and JavaScript (`sdks/js/src/ui-catalog.ts`,
from `loadFolder` in `folder.ts`). Python, .NET, Ruby, Rust and PHP don't read `ui:` yet (see the
note at the end of the `sdk` skill), and the `getstream` CLI refuses it as an unknown key
(`cli/internal/agentrc/agentrc.go`, `KnownFields`), so `getstream agents sync` fails on it. The two compilers must produce the same bytes for the same
folder: `sdks/testdata/ui/concierge/` is compiled by a Go test and a JavaScript test, both held to
`sdks/testdata/ui/concierge.instructions.txt`, which Go writes: what the model is told, the
instructions and the UI joined by a blank line, as the router joins them. An SDK that adds `ui:` checks itself
against the same pair. `a2ui` is compiled by Go (`sdks/go/agents/ui_a2ui.go`) and JavaScript
(`sdks/js/src/ui-a2ui.ts`), both held to `sdks/testdata/ui/concierge-a2ui/` and
`concierge-a2ui.instructions.txt`. JavaScript parses this YAML by hand; it still differs from yaml.v3 on
escapes inside quoted strings (`'it''s'`), empty list items, and `ui:` written as a flow mapping.
Compiled by: the router (`acceleration/internal/agentdir/ui.go` and `ui_a2ui.go`) for a sync of
files, which is what Go and JavaScript send. Both SDKs still compile it too, for the program
holding the folder (`Folder.UIInstructions` from `sdks/go/agents/ui.go`, `Folder.uiInstructions`
from `sdks/js/src/ui-catalog.ts`), until their parsers go (AI-3441). Python, .NET, Ruby, Rust and
PHP don't read `ui:` yet (see the note at the end of the `sdk` skill), and the `getstream` CLI
refuses it as an unknown key (`cli/internal/agentrc/agentrc.go`, `KnownFields`), so `getstream
agents sync` fails on it. Every compiler must produce the same bytes for the same folder:
`sdks/testdata/ui/concierge/` and `concierge-a2ui/` are compiled by the router's test, a Go SDK
test and a JavaScript test, all held to `concierge.instructions.txt` and
`concierge-a2ui.instructions.txt`: what the model is told, the instructions and the UI joined by
a blank line, as the router joins them. JavaScript parses this YAML by hand; it still differs from
yaml.v3 on escapes inside quoted strings (`'it''s'`), empty list items, and `ui:` written as a flow
mapping.

## How the model writes UI

Expand All @@ -90,7 +96,8 @@ own components, then `updateComponents`, `root` first. The prompt is the one str
renderer writes for itself (`A2UIInstructions`): its protocol and guidelines, then the catalog as
JSON Schema, the basic catalog's components and functions that `keep` names beside the app's own,
each app component as the renderer has it (`PortableComponent`: its parameters as properties, its
events joining its description). `sdks/go/agents/a2ui/` holds the basic catalog and the protocol as
events joining its description). `sdks/go/agents/a2ui/` and its copy `acceleration/internal/agentdir/a2ui/`, which a router test
holds to it, hold the basic catalog and the protocol as
the renderer has them, which `a2ui/generate.sh` writes again from a stream-chat-swift checkout; a Go
test holds the catalog to the one in `swift_assistant/a2ui/instructions.md`, which the renderer
wrote, so regenerate both together. JavaScript carries the same three files as a module,
Expand Down
28 changes: 26 additions & 2 deletions .claude/skills/sdk-go/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,32 @@ Known gaps, generated only (docs on getstream.io call some of them raw today): s
their runs, voices, knowledge documents and URLs beyond ingest and add, scheduled tasks,
campaigns, channels, connectors, a connection's credentials and tools, SIP trunks, 10DLC and opt-outs, phone
transfer, digits and release, account, credits, spend limits, usage events, teams, prices,
stats, policies, provider keys, runs, OCR and classify. Folder sync does not read
`resume_history:` from agent.yaml yet, so one that names it is refused.
stats, policies, provider keys, runs, OCR and classify.

## Folder sync

`Agent.Sync` sends an agent directory's files to `POST /v1/agents/sync/files`, and the router
(`acceleration/internal/agentdir`) reads, validates and stores them: it is what decides what
agent.yaml means, finds the connections and compiles `ui:`.

- `agents.Load` still parses the directory, as it did, to fill `Folder.Settings`, `Skills`,
`Knowledge` and the rest for the program holding it, and refuses a file it cannot read. It
decides nothing about what is stored. Removing that parser is AI-3441; until then a key added
to agent.yaml is added to the router first, and here only so `Load` does not refuse it.
- `Folder.files` reads what is sent, at sync time: the files the format names and no others
(`agent.yaml`, `instructions.md`, `guardrail.md`, `skills/`, `knowledge/`, `ui/`, the YAML
files of `simulations/`, and the two files `ui:` may name elsewhere), so a directory kept
beside a program's source sends none of it. It skips what the router skips, anything that is
not a regular file of text, and refuses a link out of the directory and a directory over
`maxSyncBytes`.
- What `Options` sets beside a `Dir` goes in the same request and wins over the files:
instructions, guardrail, the harness's name, subagent, sandbox and skills written in code,
and the cost tracking labels as tags.
- `.agent_sync` holds `hash`, the `sentHash` of the request, and `sync_hash`, what the router
stored it under: one format and one fingerprint with the JavaScript SDK. A sync is skipped
only while both still hold: the request is the same, and the stored config has that
`sync_hash` and left no connector out.
- The router does not read `resume_history:` from agent.yaml yet, so one that names it is refused.

## Errors, retries and idempotency

Expand Down
27 changes: 22 additions & 5 deletions .claude/skills/sdk-js/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,28 @@ would have to be found and undone by whoever fixes it.
socket of its own for the next caller.
- Instructions are the stored config's, written by `sync`: a session takes none.
- What is written in code wins over what a `folder` says. A directory is a starting point.
- `sync` uses **`POST /v1/agents/sync`**, one request carrying the whole directory, not the
configs/skills/knowledge sequence, with the directory's knowledge urls as `knowledge_urls` in
the same body. It sends a SHA-256 `fingerprint` of everything in the body, and a folder
from `loadFolder` records it in `.agent_sync`, so syncing on startup sends nothing when
nothing changed. The stamp's file access is handed in as `Folder.stamp` by `./node`, which
- `sync` of a folder from `loadFolder` uses **`POST /v1/agents/sync/files`**: one request
carrying what `Folder.files()` reads at sync time and what the code set beside them
(instructions, guardrail, harness, skills, `pipeline` models and the cost labels), which
wins over the files. The files are the ones the format names and no others (`agent.yaml`,
`instructions.md`, `guardrail.md`, `skills/`, `knowledge/`, `ui/`, the YAML files of
`simulations/`, and the two files `ui:` may name elsewhere), so a directory kept beside a
program's source sends none of it; `directoryFiles` skips what the router skips and anything
that is not a regular file of text, and refuses a link out of the directory and a directory
over `MAX_SYNC_BYTES`. The router (`acceleration/internal/agentdir`) reads the files, finds
the connections and compiles `ui:`, so never add a key, a default or a mapping for agent.yaml
to the sync path.
- `.agent_sync` holds `hash`, the `sentHash` of the request, and `sync_hash`, what the router
stored it under: one format and one fingerprint with the Go SDK. A sync is skipped only while
both still hold: the request is the same, and the stored config has that `sync_hash` and left
no connector out.
- `loadFolder` still parses the directory with the hand parsers in `folder.ts` and the UI
compilers, to fill `Folder.settings`, `skills` and the rest for the program holding it, and
refuses a file it cannot read. It decides nothing about what is stored. Removing those
parsers is AI-3441; until then a key added to agent.yaml is added to the router first, and
here only so `loadFolder` does not refuse it.
- An agent written in code, or a `Folder` built by hand with no `files`, uses
**`POST /v1/agents/sync`** with the fields it holds and a SHA-256 `fingerprint` of them. The stamp's file access is handed in as `Folder.stamp` by `./node`, which
keeps `Agent.sync` free of `node:fs` in the browser entry.
- `resolveConfig` turns a config *name* into an id once and caches it. A name matching nothing
stored is passed through, because it is then either an id or a mistake the router can report
Expand Down
1 change: 1 addition & 0 deletions .claude/skills/sdk/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -943,3 +943,4 @@ Connections in PHP (AI-3381, AI-3387): `$client->connections` (`sdks/php/src/Con
Ruby connections and the user parameter (AI-3380, AI-3387): `Client#connections` has `create(connector, label:, user_id:)`, `authorize(id, return_url:, user_id:)`, `get(id, user_id:)`, `list(connector:, user_id:)` (every page, `owner_type` app or user) and `delete(id, user_id:)`; a `user_id` is the owner on create and `X-Stream-User-Id` on every call, none is the app's connection with no header. `Client#get`, `post`, `put`, `patch`, `delete` and `socket` take an optional `user_id:` last (nil keeps whoever the backend acts for, empty drops it), and `Backend#acting_for` keeps working with a `@deprecated` tag pointing at it; `Dispatch#answer` acts through `Backend#acting` (`@api private`). Other SDKs follow the same rule (AI-3378..AI-3383).
A screened turn carries its guardrail check: `TimelineEntry.guardrail` and the `guardrail` field of the session socket's `turn` frame, a `GuardrailCheck` (`kind`, `model`, `probability`, `threshold`, `allowed`, `latency_ms`, `held_ms`, `mode`, `failed`), absent when no check ran; a written aside (`Agent.Ask`) is no turn, so its check is not recorded. A `type: decision_model` guardrail.md takes a `question:` key, and a guardrail webhook's body has `conversation`, the lines said before the turn. Go has the regenerated client and `agents.GuardrailAsk.Conversation`. The generated clients are regenerated for Go, JavaScript types and Python `plugins/stream`. Other SDKs need to update: Ruby, PHP, .NET and Rust should regenerate for `GuardrailCheck`, and add `conversation` to their guardrail webhook body where they have one; Swift, Kotlin and Dart read `guardrail` off the `turn` frame once they show one (Swift's client was not regenerated here: its generator needs the chat repo's `tools/openapi`).
Acting for a user (AI-3396): Go deprecated `Backend.ActingFor`: name the user on the call where it takes one (`UserID` of `client.Connections()` options, `XStreamUserId` of a generated call's params such as `CreateScheduledTaskParams`, or an `X-Stream-User-Id` set on one request with an `acceleration.RequestEditorFn`); `client.Agent(...)` calls take no per-call user yet, so `ActingFor` stays how they act for one. `ActingFor` keeps working and sends what it always did. Other SDKs need to update: JavaScript (#2110), Python (#2103), Ruby (#2102) and PHP (#2101) deprecate their own helper in their open PRs, each with an optional per-call user; .NET (#2099) and Rust (#2100) add the per-call user and have no public helper to deprecate. Until those merge, none of them is deprecated.
A directory is synced as its files, and the router reads them (AI-3441 is the follow-up): `POST /v1/agents/sync/files` takes `SyncAgentFilesRequest`, `files` (`[{path, content}]`) with `name`, `check_changes`, `base_change`, `dry_run` and what a program sets in code beside the directory, which wins over the files: `instructions`, `guardrail`, `skills`, `harness`, `subagent`, `sandbox`, `tags` (merged over agent.yaml's), `llm`, `stt`, `tts`, `sts`, `voice`, `greeting` and `video`. A client sends the files the format names (agent.yaml, `instructions.md`, `guardrail.md`, what is under `skills/`, `knowledge/` and `ui/`, the YAML files of `simulations/`, and the two files `ui:` may name elsewhere) and never the rest of the folder, which may be a project's source; it reads them at sync time, skips anything that is not a regular file of text, refuses a link out of the folder, and refuses a folder over the router's `MaxBytes` itself, by name. The router still decides which of the files sent are the directory: it skips a file or folder whose name starts with a dot, `__pycache__` and `node_modules` (`hidden` in `acceleration/internal/agentdir`), and leaves out, with one warning, whatever is no part of the format; the limits (`MaxFileBytes`, `MaxBytes` there, and `MaxFiles` for the request) and the hash are of the files it used. The router parses agent.yaml, `instructions.md`, `guardrail.md`, `skills/`, `knowledge/`, `knowledge/urls.yaml`, `simulations/*.yaml` and the UI files agent.yaml names, compiles `ui:` into `ui_instructions`, finds each connector's connection among the app's own by id or label and leaves out, with a warning and `left_out_connectors`, one the app does not have, and takes the hash itself, as the request's description spells out, answered as the config's `sync_hash`. A directory that does not read is a 400 `invalid_agent_directory` whose `error.problems` lists every problem with `file`, `line`, `column` and `message`. `dry_run` answers the config as it would be stored, refuses what the sync would refuse and writes nothing. It answers `SyncAgentResult`, as `POST /v1/agents/sync` does, which still takes the fields a client read from the directory; the result's `changes` lists each skill, knowledge document, knowledge url and simulation the sync creates, updates or deletes, and an `unsynced_changes` refusal carries `conflicts` and `last_change`. `GET /v1/agents/configs/{id}/directory` answers the stored agent as `{name, files, not_exported}`. Both new operations are server-side only. Go and JavaScript are done: `Sync` reads the files when it syncs (`Folder.files` in both) and sends them with what the code set. `.agent_sync` keeps `hash`, the SHA-256 of the request as JSON with sorted keys, and `sync_hash`, what the router answered, in one format both SDKs read; a sync is skipped only while the request is the same and the stored config still has that `sync_hash` and left no connector out. Both SDKs still parse the directory for the program holding it, and refuse locally what they always refused; the router is what validates and stores. Other SDKs need to update: Python (`plugins/stream`), .NET, Ruby, Rust and PHP should send the folder's files to `/v1/agents/sync/files` the same way and stop mapping agent.yaml and looking up connections for a sync. The `getstream` CLI (GetStream/cli) uses none of the SDKs: it has its own parser in `internal/agentrc` and should switch too. Until each does, `POST /v1/agents/sync` works as before. Removing the parsers from the SDKs, Go and JavaScript included, is AI-3441.
16 changes: 16 additions & 0 deletions .github/workflows/ci-go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ on:
- 'go.work'
- 'go.work.sum'
- '.github/workflows/ci-go.yml'
# What the router's ui_test.go holds its UI compiler and its A2UI catalog to.
- 'sdks/testdata/ui/**'
- 'examples/voice_agents/swift_assistant/a2ui/prompt.json'
- 'examples/voice_agents/swift_assistant/app/SwiftAssistant/UIComponents.json'
- '!**/*.md'
# Markdown the router embeds or its ui_test.go reads: they must stay after the *.md
# exclusion, which would otherwise drop them.
- 'acceleration/internal/agentdir/a2ui/*.md'
- 'examples/voice_agents/swift_assistant/a2ui/instructions.md'
pull_request:
branches: [ "**" ]
# A draft runs nothing: CI starts when the pull request is marked ready (ready_for_review)
Expand Down Expand Up @@ -57,7 +65,15 @@ on:
- 'go.work'
- 'go.work.sum'
- '.github/workflows/ci-go.yml'
# What the router's ui_test.go holds its UI compiler and its A2UI catalog to.
- 'sdks/testdata/ui/**'
- 'examples/voice_agents/swift_assistant/a2ui/prompt.json'
- 'examples/voice_agents/swift_assistant/app/SwiftAssistant/UIComponents.json'
- '!**/*.md'
# Markdown the router embeds or its ui_test.go reads: they must stay after the *.md
# exclusion, which would otherwise drop them.
- 'acceleration/internal/agentdir/a2ui/*.md'
- 'examples/voice_agents/swift_assistant/a2ui/instructions.md'

permissions:
contents: read
Expand Down
Loading
Loading