Streaming Agents with Pydantic AI over Typed WebSockets: Tools, Approvals, and a Generated Client

I’ve been building realtime products for years: group chat, voice pipelines, streaming AI assistants. Two kinds of pain kept following me around. The first was WebSockets. Every project grew the same untyped receive_json handler with an if/else chain, hand-written validation, and no contract the frontend could rely on. Messages were stringly-typed, bugs surfaced at runtime, and onboarding a teammate meant “read the consumer, end to end”. That pain is why I built chanx: typed messages, automatic routing, AsyncAPI docs. The second was agent frameworks. I shipped my first LLM features on LangChain and spent more time debugging its abstractions than my own code. Pydantic AI won me over the first
…