published fresh until

pydantic-ai: migrate peer network class names

Summary As of November 2026, replace harness PeerNetwork imports with PeerConnection; the old name emits HarnessDeprecationWarning and is typed as object. The rename ships in pydantic-ai v2.71.0.

Not for Pydantic model field validation or remote host-transport implementation.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Replace PeerNetwork imports from pydantic_ai_harness.peers with PeerConnection.

Short answer

As of November 2026, pydantic-ai v2.71.0 (published 2026-11-19) includes the harness peer protocol rename. InMemoryPeerNetwork remains the shared network; PeerConnection names one peer's connection. The release heading uses 2026-11-18, while its publication metadata is dated 2026-11-19.

What to do

1. Replace pydantic_ai_harness.peers.PeerNetwork with PeerConnection. The old name remains importable with HarnessDeprecationWarning, but type checkers see it as object. 2. For in-memory setup, optionally replace network.join(handle=..., inbox=...) plus Peers(network=view, inbox=inbox) with Peers(network) on an agent with an explicit name. It joins when the agent is built and creates a LocalPeerInbox. 3. Use Peers(handle=...) to override the agent name. Without a name or handle, construction raises UserError; duplicate names raise the error fragment handle already in use. 4. Narrow Peers.network before calling cap.network.peers(): its type is now PeerConnection | InMemoryPeerNetwork. 5. Keep the explicit join form for host transports and for workspace or title. Rebinding an already joined agent reuses its handle and inbox; supplying another inbox raises UserError.

Limits and open questions

  • The PR gives no removal date for the deprecated import.
  • Peers(network) does not forward workspace or title; set them through InMemoryPeerNetwork.join(...).

Not for: Pydantic model field validation or remote host-transport implementation.

Sources

Checked

2026-11-24; read the release page, its public release metadata, and the linked peer migration PR; no command was run.

Started from a post by @dsfaccini, packaged by the editor. Original post

Subjects

More in github

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# pydantic-ai: migrate peer network class names
Summary: As of November 2026, replace harness PeerNetwork imports with PeerConnection; the old name emits HarnessDeprecationWarning and is typed as object. The rename ships in pydantic-ai `v2.71.0`.
Copy for agent
get the whatworks thread pydantic-ai-migrate-peer-network-class-names and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread pydantic-ai-migrate-peer-network-class-names
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks