Skip to content

Question: Relationship between AgentPool and Pydantic-AI - Design Philosophy #22

@Leoyzen

Description

@Leoyzen

As a contributor to AgentPool, I'd like to clarify the design philosophy regarding AgentPool's relationship with pydantic-ai to better understand how to approach certain contributions and feature proposals.

Context

Based on the codebase analysis, I observe that:

  1. AgentPool has its own abstraction layer: MessageNode, BaseAgent, Tool, Team - which unifies multiple protocols (native/pydantic-ai, ACP, AG-UI, Claude Code, Codex)
  2. Pydantic-ai is used as an execution backend: For native agents, AgentPool lazily creates pydantic-ai's Agent instance via get_agentlet(), converting its own Tool abstractions to pydantic-ai's Tool using to_pydantic_ai()
  3. AgentPool adds orchestration features: Session management, protocol bridging, multi-agent teams, hooks, connections - which go beyond pydantic-ai's scope

Questions

1. Should pydantic-ai be treated as a "first-class citizen" in AgentPool?

  • Should AgentPool increasingly leverage pydantic-ai's abstractions (e.g., Agent class, RunContext, toolsets, multi-agent patterns) where they align?
  • Or should AgentPool maintain independent abstractions to support heterogeneous agent types?
    2. Is AgentPool intended as a "second-level wrapper/orchestration framework" on top of pydantic-ai?
  • Should we view AgentPool's role as: pydantic-ai handles agent execution, AgentPool handles orchestration (protocol bridging, multi-agent coordination, deployment)?
  • This aligns with the README's description: "AgentPool acts as a protocol bridge"
    3. For features that pydantic-ai provides, should AgentPool:
  • (A) Wrap and expose them (current pass-through pattern in RFC-0002/0003)
  • (B) Re-implement them in AgentPool's own abstractions
  • (C) Mix - use pydantic-ai for native agents, maintain own abstractions for cross-protocol features
    4. Specific scenarios I'm considering:
  • Multi-agent workflows: Should we use pydantic-ai's agent delegation pattern or AgentPool's Team abstraction?
  • Tool management: Should we leverage pydantic-ai's toolsets more heavily or continue with AgentPool's ToolManager?
  • Configuration: Should we expose more pydantic-ai agent options directly in YAML, or keep them behind abstractions?

Motivation

Understanding this design philosophy would help contributors:

  • Make better decisions about whether a feature belongs in AgentPool or should be delegated to pydantic-ai
  • Avoid duplicating effort on things pydantic-ai already provides
  • Maintain consistency with the project's architectural vision
  • Write more aligned code and PRs

Research Notes

I've researched both the AgentPool codebase and pydantic-ai's design philosophy:
From AgentPool:

  • Tools use to_pydantic_ai() conversion with fallback to schemez
  • BaseAgent extends MessageNode, not pydantic-ai's Agent
    From pydantic-ai:
  • Designed as "FastAPI for GenAI" - a core framework meant to be extended
  • Provides toolsets, custom agents, history processors as extension points
  • Multiple frameworks already build on top: pydantic-deep, pydantic-ai-todo, etc.
  • Has multi-agent patterns (delegation, graphs) but orchestration is left to frameworks

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions