Skip to main content
Loading navigation
Back to prompt library

Build Pydantic AI Distributed Interconnect Agent

Linked challenge: Pydantic AI & Baseten Distributed Inference Interconnect Simulator

Prompt source

implementation11 lines4 sectionsNo variables0 checklist items
from pydantic import BaseModel
from pydantic_ai import Agent, RunContext

class ClusterState(BaseModel):
    gpu_count: int
    topology: str
    failed_links: list[str]

agent = Agent('openai:gpt-4o', deps_type=ClusterState, result_type=dict)

@agent.tool
async def simulate_nccl_allreduce(ctx: RunContext[ClusterState], tensor_size_mb: float) -> dict:
    # Simulate collective communication over degraded links
    pass