Skip to content

recipe(voice-agents): agent_ws_client_tools — Atoms Agent WS client-tools sample - #78

Open
abhishekmishragithub wants to merge 1 commit into
mainfrom
feat/agent-ws-client-tools
Open

recipe(voice-agents): agent_ws_client_tools — Atoms Agent WS client-tools sample#78
abhishekmishragithub wants to merge 1 commit into
mainfrom
feat/agent-ws-client-tools

Conversation

@abhishekmishragithub

Copy link
Copy Markdown
Collaborator

Summary

New voice-agents cookbook: minimal Node.js sample of the client-tools protocol on the Atoms Agent WebSocket (`wss://api.smallest.ai/atoms/v1/agent/connect`). Pairs with the docs shipped in smallest-ai-documentation#378 (originally #337) so the protocol has a working end-to-end reference on the customer side.

What's in it

  • `index.mjs` — runnable Node 18+ client. Mints the `wct_` access token, opens the WS, declares a runtime `lookup_order` tool via `session.update`, and handles the `function_call` / `function_call.result` round-trip. Handles the six documented error codes.
  • `README.md` — message-flow diagram, rules of the road (dashboard vs runtime tools, additive vs replace semantics, 64 KB output cap, WS-only availability), and run instructions.
  • `AGENTS.md` — so a coding agent (Claude, Cursor, Codex) can extend the sample without extra prompting.
  • `package.json` — deps are just `ws`.

Verified live

Ran against `api.smallest.ai` with a real API key + agent id:

```
opening wss://api.smallest.ai/atoms/v1/agent/connect?token=wct_...
ws open
session.created call_id=CALL-1787313848478-e9cb30 sr=24000
session.updated accepted=["lookup_order"]
```

Full `function_call → function_call.result` handling is in the code path; not exercised in the smoke test because that requires the caller to actually ask the agent to call the tool (mic audio or text). Unit-test the `runTool` branch in isolation.

Test plan

  • `npm install` + `npm start` opens the WS, declares one tool, receives `session.updated` ACK
  • Node 18+ engines guard in package.json
  • node_modules gitignored

…ools sample

Minimal Node.js sample of the client-tools protocol on
wss://api.smallest.ai/atoms/v1/agent/connect (session.update,
function_call, function_call.result, plus the error codes:
tool_name_conflict, client_tools_managed_by_config, invalid_tools,
tool_timeout, unknown_call_id, result_too_large).

Ships with a runnable index.mjs, README with the message-flow diagram,
and an AGENTS.md so a coding agent can extend the sample without extra
prompting. Requires Node 18+.

Verified live end-to-end: register-call mints wct_ token, WSS
handshake, session.update sends 1 tool, server ACKs session.updated
with the accepted tool name.

Paired doc PR: smallest-inc/smallest-ai-documentation#337 / #378.
@vercel

vercel Bot commented Aug 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
smallest-showcase Ready Ready Preview Aug 21, 2026 12:05pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant