migrating-google-adk-to-pydantic-ai

Migrate Python Google Agent Development Kit (ADK) applications to Pydantic AI. Use for `LlmAgent`, `Runner`, sessions, state, memory, tools, callbacks, plugins, graph or dynamic workflows, resumability, events, artifacts, MCP, and ADK deployment boundaries.

Install
npx skills add 'https://github.com/pydantic/pydantic-ai/tree/main/pydantic_ai_slim/pydantic_ai/.agents/skills/migrating-google-adk-to-pydantic-ai'
Download bundle ↓
main · 9e9fdc4Scanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

references/CONCEPT-MAPPING.md

references/CONCEPT-MAPPING.mdBrowse 5 files
View on GitHub
← Back to SKILL.md

Concept Mapping

Map behavior only after tracing the active ADK caller path. Keep existing application infrastructure unless the migration explicitly includes it.

Google ADK sourceNormal Pydantic AI targetFocused proof
LlmAgent(model, instruction, tools)Core Agent(model, instructions, tools)Prompt, tool calls, final output, and errors
Dynamic instruction / deprecated global_instruction / GlobalInstructionPluginInstructions functions using typed RunContext dependencies; attach tree-wide instructions to every migrated agent or one shared capabilityTrusted values reach prompts but not tool schemas and apply to the same agents
input_schema / output_schemaExisting input adapter plus output_type; typed graph/node data where applicableAccepted/rejected payloads and wire shape
FunctionTool / Python callable@agent.tool, @agent.tool_plain, Tool, or FunctionToolsetName, schema, validation, error, and side effect
ToolContext / CallbackContextRunContext plus typed dependencies; application services for persistenceIdentity and clients are not model arguments
Runner.run_async() / Event.is_final_response()Agent.run(), run_stream_events(), or an application adapterSync/async form, IDs, event order, final response
Session.eventsNormalized ModelMessage history when it is model contextMulti-turn replay and persisted reload
Session.state, including app:, user:, and temp: keysApplication/workflow state with explicit scope and lifetimeCross-session isolation, invocation lifetime, concurrency
MemoryService and load_memoryExisting retrieval service, or Harness Memory if its store/search policy matchesIngestion, search ranking, tenant scope, deletion
ArtifactService and artifact deltasExisting versioned blob/file serviceVersion lookup, user/session scope, cleanup, errors
output_keyExplicit Python/graph output flow or an application state writeDownstream value and persistence timing
Workflow graph / node / Event.routePlain async Python or pydantic_graphRoutes, typed inputs/outputs, fan-out/join, failures
Dynamic ctx.run_node()Plain async composition, pydantic_graph, and a durable backend only when requiredScheduling order, execution IDs, retries, restart
SequentialAgent / ParallelAgent / LoopAgentPlain Python, pydantic_graph, or explicit agent compositionOrder, context isolation, stop condition, race/failure behavior
sub_agents with mode='chat'Core delegation/programmatic hand-off/model routingWhich agent sees which history and answers the user
sub_agents with mode='task' or mode='single_turn'A typed agent tool or Harness SubAgents only when isolation, return, interaction, and concurrency semantics matchInput visibility, return control, user interaction, parallelism, output
AgentToolA typed tool that runs another Agent; Harness SubAgents when the task is self-containedInput prompt, usage propagation, history isolation, returned output
before_* / after_* callbacksCore HooksOrder, mutation, short-circuit, errors, sync/async behavior
Runner-wide BasePluginOne reusable capability or application instrumentation/policyGlobal coverage, lifecycle, early exit, cleanup
require_confirmation, ToolConfirmationrequires_approval or ApprovalRequiredToolset to gate the tool; resolve inline with HandleDeferredToolCalls, or return DeferredToolRequests and resume a later run with DeferredToolResults; use ToolApproved.override_args and deferred metadata when the confirmation payload changes executionCorrelation, approve/deny, overridden arguments, metadata, no side effect before approval
Workflow RequestInputApplication or graph pause/resume boundaryPrompt, response correlation, restart; do not imply authorization
LongRunningFunctionToolDeferred external execution, application jobs, or durable stepsPending response, correlation, completion/error delivery
McpToolsetCore MCP toolsetsTransport lifecycle, tool filtering/names, auth, errors
SkillToolsetHarness Skills for portable SKILL.md instructionsDiscovery, selection, instruction loading
ADK code executor / environmentHarness FileSystem and Shell, or ModalSandboxContainment, credentials, timeout, persistence, output
Event and text streamingrun_stream_events() for lifecycle events; run_stream() for output streamingChunk boundaries, event types/order, completion, cancellation
Context compactionCore/Harness compaction selected by the observed policyPreserved pinned content and behavior near token limits
Resume/replayCore durable integrations or Harness step persistence, chosen by required guaranteesKill/restart and idempotent external effects
Realtime/liveCore realtime when modality/provider contracts matchAudio/text turns, interruption, tool calls, session closure
A2A, CLI/web/API server, deploy, evalsKeep the application/protocol boundary; migrate separately if requestedExisting consumer and operational tests

Routing rules

  • Prefer core for the agent loop, normalized messages, typed dependencies, tools, output, hooks, streaming, MCP, approvals, and durable-runtime primitives.
  • Use Harness for optional reusable policy such as memory, skills, subagents, planning, workspace tools, context management, guardrails, or an isolated execution environment.
  • Keep auth, stores, queues, endpoints, deployment, and product state in the application.
  • Record a gap when the target cannot preserve a contract through a supported public API. Build a bounded adapter only after the impact is known.

Google ADK's current concepts are documented under agents, workflows, runtime, sessions, tools, callbacks, plugins, and skills. Check the installed source because experimental and workflow APIs move quickly.

Referenced from SKILL.md