PydanticAI vs OpenAI Agents SDK vs Google ADK: Which Python Agent Framework Should You Choose in 2026?
Three Python agent frameworks can all call tools and delegate work, but they make very different decisions about who controls the workflow. PydanticAI puts typed application code and validated outputs at the centre. OpenAI Agents SDK gives you a small runtime built around agents, tools, handoffs, guardrails and sessions. Google Agent Development Kit (ADK) makes explicit workflow graphs and session-aware execution first-class concepts.
That difference matters when a prototype becomes a service. A support agent that only answers questions is easy to build in any of them. A support agent that reads tenant-scoped orders, routes refund requests, waits for approval, survives a restart and produces an auditable result needs a much more deliberate architecture.
This guide compares the three frameworks through that production problem. It includes a decision matrix, installation notes and Python examples for a common support workflow. It is an engineering comparison, not a benchmark: no framework is declared faster or more accurate without a controlled test on your own model, tools and workload.
Who should read this guide
- Python backend engineers choosing an agent framework for a new product.
- Teams moving from a prompt-and-tools prototype to a multi-step workflow.
- Developers who need typed outputs, human approval, session persistence or model-provider flexibility.
- Engineering leads comparing the operational cost of framework-specific abstractions.
Prerequisites
- Comfort with Python 3.11 or newer, async functions and virtual environments.
- Basic familiarity with LLM tool calling and JSON schemas.
- A model API key for the provider used by your chosen framework. ADK can also use supported non-Gemini model integrations.
- A small application service or mock repository for the example. The code below deliberately keeps payment execution behind an application-owned interface.
Version snapshot: November 29, 2026
Framework APIs move quickly, so this comparison pins a reproducible documentation snapshot rather than treating package versions as timeless recommendations:
- PydanticAI 2.77.0 — released November 27, 2026. Its release notes include changes to conversation stores, compaction events, delegated runs and streaming completion states. See the official release history.
- OpenAI Agents SDK 0.26.0 — released November 24, 2026. The release includes Realtime demo updates and changes affecting Docker sandbox mounts, tracing and MCP metadata. See the official release notes.
- Google ADK Python 2.15.1 — released November 24, 2026, with fixes around model sampling, A2A streaming, tool argument validation and instruction routing. See the official release history.
Pin the versions you test in your lockfile. Do not assume that a snippet copied from an older tutorial is still the recommended API: ADK 2.0, for example, moves new Python workflow design toward graph-based Workflow objects instead of the older template workflow agents.
The short answer
| Choose | When it fits best | Main architectural idea |
|---|---|---|
| PydanticAI | Your Python application owns the workflow, and you want strong typing, dependency injection, structured output and provider choice. | Typed agents and tools composed by application code; add graph or durable-execution capabilities when the workflow needs them. |
| OpenAI Agents SDK | You want a compact agent runtime with a clear tool loop, handoffs, guardrails, sessions, approval interruptions and built-in tracing. | Agents plus a Runner; handoffs transfer control, while agent-as-tool keeps a manager in charge. |
| Google ADK | You need explicit workflow graphs, session-aware execution, event-based data flow and a structured path into Google's agent tooling. | Agents and code nodes arranged into a deterministic or dynamic workflow graph. |
None is a universal winner. If your process is mostly ordinary Python business logic with one model call, a framework may add more concepts than value. Start with the smallest runtime that solves the actual orchestration problem.
1. Understand the three control-flow models
PydanticAI: application code and typed boundaries
PydanticAI's core abstraction is an Agent. You configure a model, instructions, tools, dependency type and optional output type. A run returns a typed result, and tools can receive application dependencies through RunContext. The application decides when to call one agent, delegate to another, or move to a graph.
Its multi-agent guide describes several levels: a single agent, delegation through tools, programmatic hand-off, graph-based control flow and deeper autonomous-agent patterns. This is useful when you want to add orchestration only where the workflow actually needs it. PydanticAI also documents durable-execution integrations with engines such as Temporal, DBOS, Prefect and Restate; that is an integration choice, not a claim that every simple agent run is automatically a durable business process.
Primary references: Agents, Dependencies, Multi-agent applications and Durable execution.
OpenAI Agents SDK: a small runtime around the agent loop
The OpenAI SDK centres on Agent and Runner. An agent carries instructions, tools, handoffs, output configuration and guardrails. The Runner manages model turns and tool execution. A handoff transfers control to a specialist; an agent exposed as a tool lets the original manager keep control and consume the specialist's result.
The SDK also includes sessions for conversation history, tracing, MCP integration and human-in-the-loop interruptions. These are useful building blocks, but they are not interchangeable with a general-purpose durable workflow engine. Persistent chat history does not automatically make an external payment, database update or multi-day business process exactly-once.
Primary references: SDK overview, Agent orchestration, Handoffs, Sessions and Human-in-the-loop.
Google ADK: workflow graphs and session-aware execution
ADK provides LLM agents, tools, sessions, runners and workflow nodes. In ADK 2.0, a graph can combine model-driven agents with deterministic Python functions, branches, loops, parallel work and human-input steps. A node emits an event, and the graph determines what runs next. That makes the control flow visible in code instead of relying on a prompt to remember the entire procedure.
ADK is designed to work naturally with Gemini and Google Cloud, but its documentation also covers other model providers and deployment choices. Its Session and Runner abstractions manage conversation state and execution. For new Python workflow code, follow the current graph documentation rather than starting from older examples based on SequentialAgent, ParallelAgent or LoopAgent; the current documentation marks those older template workflow classes as deprecated in Python and TypeScript in favour of Workflow.
Primary references: ADK documentation, Graph workflows, Graph routes and Conversational context.
2. Compare the features that change production design
| Engineering concern | PydanticAI | OpenAI Agents SDK | Google ADK |
|---|---|---|---|
| Control flow | Ordinary Python composition, delegation and optional graph-based patterns. | Runner loop, handoffs and manager-style agent tools. | Explicit workflow graph with nodes, edges and event outputs. |
| Typed data | Strong focus on typed dependencies, tool arguments and validated outputs. | Python tool schemas, Pydantic-powered validation and structured outputs. | Tool schemas, output schemas and typed workflow data boundaries. |
| Provider approach | Broad provider integrations are a central design goal. | OpenAI-first defaults, with documented ways to use other model providers. | Gemini-first experience with documented integrations for other providers. |
| Human approval | Use deferred tool requests or application/workflow approval patterns appropriate to the capability in use. | Tool approval interruptions can pause a run, serialize state and resume it. | Tool confirmation and graph human-input nodes support different approval patterns. |
| Conversation state | Message history and persistence integrations; durable execution can be paired with a workflow engine. | Multiple session backends and resumable RunState for supported interrupted runs. | SessionService implementations, event history and state scoped to app, user or session. |
| Observability | OpenTelemetry and Logfire instrumentation options. | Built-in tracing for model calls, tools, guardrails and handoffs. | Events, logging, metrics, traces and evaluation tooling. |
| Best fit | Typed Python product services with provider choice. | Agent-centric applications that benefit from a managed loop. | Explicit multi-step processes with visible routing and state. |
3. Install pinned versions and keep credentials outside source code
Create separate virtual environments when evaluating the frameworks. Their optional dependencies can overlap, but isolated environments make dependency conflicts easier to diagnose.
python -m venv .venv
source .venv/bin/activate
# Choose one package for the experiment:
pip install "pydantic-ai==2.77.0"
# or:
pip install "openai-agents==0.26.0"
# or:
pip install "google-adk==2.15.1"
On Windows PowerShell, activate the environment with .venv\Scripts\Activate.ps1. Store provider credentials in environment variables or a secret manager. Never put a production key in a notebook, checked-in .env file or agent instruction.
For the examples, imagine a support service with an authenticated tenant, an order repository and a payment service. The agent may look up an order and propose a refund, but the application—not the model—owns authorization, refund limits and the final side effect.
4. Build the same typed support agent with PydanticAI
PydanticAI is a natural starting point when the important boundary is a typed Python function. The dependency object carries trusted application services into the run. The output model constrains the result your API receives.
from dataclasses import dataclass
from typing import Literal
from pydantic import BaseModel
from pydantic_ai import Agent, RunContext
@dataclass
class SupportDeps:
order_repository: object
tenant_id: str
class TicketDecision(BaseModel):
intent: Literal["status", "refund", "other"]
order_id: str | None = None
summary: str
agent = Agent(
"openai:YOUR_MODEL_ID",
deps_type=SupportDeps,
output_type=TicketDecision,
instructions=(
"Classify the support request. Use lookup_order only "
"for an order the authenticated customer is allowed to access. "
"Never issue a refund or claim that one has been issued."
),
)
@agent.tool
async def lookup_order(
ctx: RunContext[SupportDeps],
order_id: str,
) -> dict:
"""Read an order belonging to the authenticated tenant."""
return await ctx.deps.order_repository.get_for_tenant(
tenant_id=ctx.deps.tenant_id,
order_id=order_id,
)
async def classify_ticket(message: str, deps: SupportDeps) -> TicketDecision:
result = await agent.run(message, deps=deps)
return result.output
The repository method is intentionally tenant-scoped. Do not accept a tenant ID from the model as proof of identity. The authenticated request should create SupportDeps, and the repository should enforce the tenant filter again at the database boundary.
The return value is validated as TicketDecision, but validation does not prove that the decision is factually correct or authorized. Treat it as a structured proposal. The API layer should check that the order exists, belongs to the caller and is eligible for the requested action.
For a multi-agent workflow, you can let one agent call a specialist as a tool, call another agent in application code, or introduce a graph. The framework does not force every application into a single orchestration style.
5. Build the same approval boundary with OpenAI Agents SDK
The OpenAI SDK is useful when you want a Runner-managed loop and a clear approval interruption. The decorator below marks a refund tool as requiring approval. The Runner pauses before executing the tool, and your application resolves the pending interruption.
from agents import Agent, Runner
from agents.decorators import tool
@tool
async def lookup_order(order_id: str) -> str:
"""Read a customer's order from the application service."""
return await order_service.get_order_summary(order_id)
@tool(needs_approval=True)
async def issue_refund(order_id: str, amount: float) -> str:
"""Issue a refund after an authorised reviewer approves it."""
return await payment_service.refund(
order_id=order_id,
amount=amount,
idempotency_key=f"refund:{order_id}",
)
billing_agent = Agent(
name="Billing specialist",
instructions=(
"Check refund eligibility. Request the refund tool only "
"when the application policy says it is eligible."
),
tools=[lookup_order, issue_refund],
)
support_agent = Agent(
name="Support triage",
instructions="Route billing issues to the billing specialist.",
handoffs=[billing_agent],
)
async def start_support_run(message: str):
result = await Runner.run(support_agent, message)
if result.interruptions:
state = result.to_state()
# Store state in trusted server-side storage, keyed to the
# authenticated user and this run. Do not send the raw snapshot
# to a browser and trust it when it comes back.
state_id = await approval_store.save(state.to_string())
return {"status": "approval_required", "state_id": state_id}
return {"status": "complete", "answer": result.final_output}
This example stops at the approval boundary because the approval UI and storage are application-specific. When a reviewer responds, load the server-owned RunState, authenticate and authorize the reviewer, approve or reject the stored interruption, then resume the original top-level agent with Runner.run(agent, state). The SDK documentation explains the complete pause/approve/resume flow.
Do not treat an approval decision as exactly-once execution. If a refund succeeds but the process crashes before it saves the updated run state, a retry may attempt the refund again. Use a stable idempotency key at the payment provider and reconcile uncertain outcomes before retrying.
6. Model the workflow explicitly with Google ADK
ADK is attractive when routing itself should be visible and deterministic. A graph can place model reasoning at selected nodes while keeping branch decisions and critical actions in application code. The following compact example routes a triage result to one of two specialist agents.
from google.adk import Event, Workflow
from google.adk.agents import Agent
triage_agent = Agent(
name="triage",
model="gemini-flash-latest",
instruction=(
"Classify the request. Return exactly REFUND or STATUS. "
"Do not perform an action."
),
)
refund_agent = Agent(
name="refund_specialist",
model="gemini-flash-latest",
instruction="Check refund policy and prepare a proposal. Do not issue it.",
)
status_agent = Agent(
name="order_status_specialist",
model="gemini-flash-latest",
instruction="Explain the order status using approved read-only tools.",
)
def choose_route(classification: str):
if "REFUND" in classification.upper():
return Event(route="REFUND")
return Event(route="STATUS")
root_agent = Workflow(
name="support_workflow",
edges=[
("START", triage_agent, choose_route),
(
choose_route,
{
"REFUND": refund_agent,
"STATUS": status_agent,
},
),
],
)
The graph makes the branch visible, but the classification still comes from a model and can be wrong. For consequential operations, use deterministic policy checks after the model node. ADK also documents tool confirmation through FunctionTool(..., require_confirmation=True) and graph-level human input through RequestInput. These are different mechanisms: one confirms a tool call, while the other pauses a workflow for a human-provided input.
from google.adk.agents import Agent
from google.adk.tools import FunctionTool
def issue_refund(order_id: str, amount: float) -> str:
"""Issue a refund through the application payment service."""
return payment_service.refund(
order_id=order_id,
amount=amount,
idempotency_key=f"refund:{order_id}",
)
refund_agent = Agent(
name="refund_agent",
model="gemini-flash-latest",
instruction="Prepare eligible refunds and request confirmation before execution.",
tools=[FunctionTool(issue_refund, require_confirmation=True)],
)
For production, configure a persistent SessionService appropriate to your deployment rather than relying on an in-memory development service. ADK's session documentation describes session services and state. The graph is an orchestration model; it does not replace database transactions, authorization or payment idempotency.
7. Decide how much state your application actually needs
State is where framework comparisons often become misleading. There are at least three different things people call memory:
- Turn history: messages and tool results needed to continue a conversation.
- Workflow state: which business step completed, which approval is pending and what should happen after a restart.
- Business records: the authoritative order, refund, invoice or ticket in your database.
A session backend can preserve turn history without guaranteeing that an external business operation is safe to replay. A serialized run can preserve a pending approval without authenticating the person who submits the approval. A workflow engine can persist execution progress without replacing your payment ledger.
- With PydanticAI, choose message-history storage for conversations and pair the agent with a durable execution engine when a workflow must survive process failure.
- With OpenAI Agents SDK, choose a session backend for conversation history and use
RunStatefor supported paused-run recovery. Store serialized state on the server and bind it to a user, tenant and run. - With ADK, choose a persistent SessionService and explicit workflow state for multi-step processes. Keep authoritative business state in your own database.
If your workflow must wait hours or days for approval, retry after worker loss, or coordinate multiple services, compare a dedicated durable workflow engine as well. GyanAangan's Temporal vs Celery guide covers that separate infrastructure decision.
8. Evaluate behavior before choosing a winner
Do not choose based only on the shortest hello-world example. Build a small, repeatable evaluation set for the task your product will actually perform.
- Prepare representative cases. Include clear requests, ambiguous requests, missing order IDs, cross-tenant IDs, ineligible refunds, tool timeouts and prompt-injection attempts.
- Record expected tool trajectories. For each case, define which read-only tools may run, which branch should be selected and which actions must never run.
- Measure schema correctness. Check whether the final output validates and whether required fields are populated. A valid schema is necessary but not sufficient.
- Measure policy compliance. Count unauthorized reads, unapproved writes, incorrect approvals, duplicate side effects and cases where the agent claims an action succeeded when it did not.
- Measure operational behavior. Record model calls, tool calls, retries, token usage, timeouts, cancellation behavior and recovery after a worker restart.
- Run the same cases on all three. Keep the model, prompts, tools, data, timeout and concurrency as similar as possible. Report the setup with every result.
Use each framework's supported testing and evaluation path, then add application-level tests around authorization and side effects. See Pydantic Evals, the OpenAI Agents SDK testing guide and ADK evaluation. For a broader RAG regression approach, see GyanAangan's Ragas vs DeepEval vs Phoenix evaluation deep dive.
9. Security and privacy checklist
- Authenticate outside the model. Derive tenant and user identity from trusted middleware. Never trust IDs generated by a model as authorization evidence.
- Make tools least-privilege. Give the agent a read-only order lookup tool before considering any write tool. Separate refund proposal from refund execution.
- Require approval for consequential actions. Approval should display the exact order, amount, destination and action. Re-check policy after approval and immediately before execution.
- Use idempotency and reconciliation. A framework checkpoint cannot make a remote payment API and your database update one atomic transaction.
- Protect session and checkpoint storage. OpenAI's RunState documentation warns that serialized state is not authenticated by the SDK. Keep snapshots in trusted storage, verify ownership and prevent replay.
- Limit prompt-injection impact. Treat retrieved documents, tool output and user text as untrusted data. Do not let instructions found in those sources expand tool permissions.
- Review tracing and retention. Traces can contain prompts, arguments and tool results. Redact secrets and personal data, restrict access and set retention rules before enabling production tracing.
- Keep framework and provider keys separate. Use secret managers, rotate keys and scope credentials to the smallest set of tools and services.
For MCP-based tools, apply the same server-side authorization and approval rules. Related reading: Secure Multi-Tenant MCP Servers with Python SDK and MCP Sampling migration.
10. Trade-offs and limitations
PydanticAI
- Strength: Typed dependencies and outputs fit naturally into Python service code. Provider flexibility makes it easier to keep model choice separate from business logic.
- Trade-off: You decide how much orchestration, persistence and operational infrastructure to add. That flexibility can become a collection of application-owned conventions if the team does not standardize them.
- Limitation: Type validation cannot establish factual correctness, tenant authorization or safe execution of a tool.
OpenAI Agents SDK
- Strength: A compact set of concepts covers the common agent loop, tools, handoffs, guardrails, sessions, tracing and approvals.
- Trade-off: Its defaults and deepest integrations are OpenAI-oriented. Non-OpenAI provider setups need an explicit compatibility review.
- Limitation: Guardrails and approvals are attached to specific execution paths. Read the current documentation for hosted tools, handoffs and nested agents rather than assuming one guardrail automatically wraps every operation.
Google ADK
- Strength: Explicit workflow graphs make branching, deterministic steps and human input visible. Sessions and event-based execution give teams a structured runtime.
- Trade-off: The graph and session abstractions introduce more framework concepts than a single-agent Python function. Teams outside Google Cloud should validate their model and deployment integrations early.
- Limitation: A deterministic graph can still contain nondeterministic model decisions. Graph routing does not make the model's classification correct or make external side effects transactional.
11. Troubleshooting common problems
| Symptom | What to check |
|---|---|
| Provider or model initialization fails | Check the installed optional provider dependencies, environment variables, model identifier and whether the selected provider supports the requested tool/output mode. |
| Structured output keeps retrying | Reduce schema complexity, make fields and enums explicit, inspect validation errors and verify that the model supports the chosen structured-output method. |
| A tool is never selected | Improve the tool name and docstring, narrow its purpose, inspect the actual tool schema and add a test that verifies the intended tool trajectory. |
| Approval pauses but never resumes | Persist the framework's supported run state, store the pending tool-call identifiers, authenticate the reviewer and resume the original top-level run with the same session context. |
| ADK graph takes an unexpected branch | Log the exact node output and emitted route value. Do not route from free-form prose if a small enum or deterministic policy function can express the decision. |
| Duplicate refund after retry | Use destination-enforced idempotency and reconcile the payment provider's result before replaying an uncertain operation. |
| Conversation history disappears | Check whether the app uses an in-memory service, whether the same session ID and backend are reused, and whether expiry or retention rules removed the record. |
| Traces expose private data | Inspect trace processors, redact sensitive fields before export, restrict dashboards and apply a documented retention policy. |
12. A practical selection process
- Choose PydanticAI if your team thinks in typed Python services, wants broad model-provider choice and prefers to own orchestration. Add graph or durable-execution infrastructure only when required.
- Choose OpenAI Agents SDK if the agent loop, handoffs, guardrails, approval interruptions and tracing are the centre of the product and its provider model fits your architecture.
- Choose Google ADK if you need explicit workflow graphs, session-aware execution, event-driven routing and close alignment with Google's agent ecosystem.
- Prototype one real workflow in the top two candidates. Include a tool timeout and a denied approval; the happy path alone tells you very little about production behavior.
- Keep the business boundary independent. Put authorization, repositories, payment APIs, idempotency and audit logging in your application layer so the framework can be replaced without rewriting core policy.
There is also no requirement to force every workflow into an agent framework. A conventional service with one structured model call may be easier to test and operate. Use an agent runtime when the model genuinely needs to choose tools or delegate work; use deterministic code for policy, accounting and irreversible actions.
Frequently asked questions
Is PydanticAI better than OpenAI Agents SDK?
Not universally. PydanticAI is especially attractive for typed Python services and provider flexibility. OpenAI Agents SDK offers a compact runtime with built-in handoffs, sessions, tracing and approval interruptions. Compare them against your provider, state and operational requirements.
Is Google ADK only for Gemini?
No. ADK is optimized for Gemini and Google tooling, but its documentation includes integrations for other model providers. Verify the exact model and tool features you need rather than assuming every provider supports every capability identically.
Which framework is best for multi-agent systems?
It depends on how you want control flow represented. PydanticAI supports delegation and graph-based patterns, OpenAI Agents SDK provides handoffs and agent-as-tool patterns, and ADK offers explicit workflow graphs and collaborative agent patterns.
Which one supports human approval?
All three can be used in human-in-the-loop designs, but the mechanisms differ. OpenAI Agents SDK has tool approval interruptions and resumable RunState. ADK has tool confirmation and workflow human-input nodes. PydanticAI supports deferred tool requests and can be combined with application or durable-workflow approval mechanisms. Build the approval UI and authorization in your own application.
Does session persistence make an agent workflow durable?
No. Session persistence usually means conversation history is saved. Durable business execution also requires checkpointing the process, coordinating retries, handling external side effects and reconciling uncertain outcomes. Treat those as separate design requirements.
Can I use local models with these frameworks?
Provider support varies by framework and model feature. PydanticAI has documented integrations for local and OpenAI-compatible providers; OpenAI Agents SDK documents non-OpenAI provider adapters; ADK documents integrations such as Ollama and vLLM. Test structured outputs, tool calling, streaming and error behavior with the exact model server you plan to deploy.
Should I use LangGraph instead?
LangGraph is another valid option, especially when explicit graph state, checkpointing and interrupts are central to the application. This comparison does not rank it. GyanAangan's LangGraph human-in-the-loop guide is a useful companion when evaluating graph-first orchestration.
Primary documentation and release references
- PydanticAI releases and Agent API documentation.
- PydanticAI dependencies, multi-agent applications, durable execution and Pydantic Evals.
- OpenAI Agents SDK releases, quickstart, handoffs, guardrails, human-in-the-loop and testing.
- Google ADK Python releases, graph workflows, graph routes, human input, sessions and evaluation.
Final takeaway
Choose the framework by asking one question: where should control flow live? If it belongs in typed application code, start with PydanticAI. If you want a compact managed agent loop with handoffs and approval interruptions, evaluate OpenAI Agents SDK. If the process should be an explicit graph of model and code nodes, evaluate Google ADK. Then test the same failure cases, approvals and side effects in each candidate before committing.
