client-sdk.md
attributes
| source_path | references/client-sdk.md |
|---|---|
| source_sha256 | efda15f0562b05832cc7017da1d3398764c1d4f125ea03f68df149e074c107e6 |
| source_url | https://github.com/cloudflare/skills/blob/47dfc2ce969bf62acf8bc231198ade4bb02712e0/skills/agents-sdk/references/client-sdk.md |
| supporting_skill_id | 40176 |
| upstream_revision | 47dfc2ce969bf62acf8bc231198ade4bb02712e0 |
Client SDK
Choose useAgent for React state/RPC, AgentClient for other WebSocket clients, and agentFetch for one-off HTTP requests. Add useAgentChat when the UI needs chat messages and streaming. Check installed package versions before adapting current examples.
| Task | Documentation |
|---|---|
| Connect, sync state, call RPC, or send HTTP requests | Client SDK — hooks, vanilla JS, typed calls, streaming callbacks, and connection options |
| Build chat UI | Chat agents — useAgentChat, message rendering, status, and tool interactions |
| Authenticate across origins | Cross-domain authentication — token validation and WebSocket authentication |
Keep client instance selection consistent with server routing. For authentication, account for token refresh on reconnect and query caching. Close manually created AgentClient connections when finished; React hooks manage their own cleanup.
Children
No children yet.
Like how this is organised?
Build your own Memory tree on knowen.md: notes, decisions and tasks in one connected markdown graph, shared with your team and your AI agents.