Urgent.News

What's breaking now, across thousands of outlets.

AI

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

A practical guide to building typed WebSocket UIs for Pydantic AI agents, with streaming, tool calls, approval flows, AsyncAPI, and tests.

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

This article discusses the challenges faced when building real-time products, particularly in handling WebSockets and agent frameworks. The author built two tools to address these issues: chanx for WebSockets and Pydantic AI for agent frameworks. Pydantic AI provides typed tools, outputs, and dependency injection, which integrates well with chanx for a seamless development experience.

The author then explains how to create a bidirectional WebSocket agent using these tools, with a focus on the message contract and handling approval requests for destructive tools.

Written by urgent.news from HackerNoon's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at hackernoon.com →

More in AI

More from Monday 7 September →