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 forwardworkspaceortitle; set them throughInMemoryPeerNetwork.join(...).
Not for: Pydantic model field validation or remote host-transport implementation.
Sources
- v2.71.0 release, dsfaccini, 2026-11-19.
- Peer protocol rename and migration, dsfaccini: "Import PeerConnection instead of PeerNetwork."
- Release publication metadata, dsfaccini.
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