К основному содержанию
скилл CX Codex

migrating-google-adk-to-pydantic-ai — скилл для Claude Code

Помогает переносить Python-приложения с Google ADK на Pydantic AI, сохраняя поведение вызовов, инструментов, состояния и рабочих процессов.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add pydantic/skills --skill migrating-google-adk-to-pydantic-ai -a claude-code
Открыть на GitHub

Что делает migrating-google-adk-to-pydantic-ai

Скилл разбирает реальный путь запроса: от Runner.run_async() или endpoint до агента, модели, инструментов, callbacks, plugins, сессии, событий и итогового ответа. Он помогает выбрать замену для LlmAgent, графов, динамических workflow и делегирования между агентами, а также разделить историю сообщений, состояние, память, артефакты и checkpoint-ы.

Рекомендации опираются на тесты паритета и характеристические тесты. Для обычного LlmAgent предлагается Agent с типизированными зависимостями, инструментами и результатом; для явных узлов и ветвлений — pydantic_graph. Скилл отдельно проверяет resumability, повторный запуск инструментов, порядок callbacks и поток событий.

Продуктовую инфраструктуру нужно оставлять в приложении: хранилища сессий, состояние, артефакты, очереди, транспорт, A2A endpoints и deployment. Пока сохранённый runtime импортирует или вызывает google-adk, удалять эту зависимость нельзя.

Какие задачи решает

  • перенести LlmAgent и Runner на Pydantic AI
  • разделить историю сообщений, состояние и долгосрочную память
  • сопоставить ADK tools, callbacks и plugins
  • сохранить возобновление workflow и побочные эффекты
  • проверить паритет событий и финального ответа

Примеры запросов агенту

  • Проанализируй путь запроса от Runner.run_async() и составь план миграции на Pydantic AI.
  • Сопоставь LlmAgent, Session.events, tools и callbacks с эквивалентами Pydantic AI.
  • Подготовь тесты паритета для workflow с resume, артефактами и повторным вызовом инструментов.

Как установить migrating-google-adk-to-pydantic-ai

1Через Skills CLI (Vercel)

npx skills add pydantic/skills --skill migrating-google-adk-to-pydantic-ai -a claude-code

2Вручную: положить файлы

~/.claude/skills/migrating-google-adk-to-pydantic-ai/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/migrating-google-adk-to-pydantic-ai/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Вопросы о migrating-google-adk-to-pydantic-ai

Как установить migrating-google-adk-to-pydantic-ai в Claude Code?

Запустите npx skills add pydantic/skills --skill migrating-google-adk-to-pydantic-ai -a claude-code. Файл скилла будет доступен по пути ~/.claude/skills/migrating-google-adk-to-pydantic-ai/SKILL.md.

Что делает migrating-google-adk-to-pydantic-ai?

Скилл помогает перенести приложения Google ADK на Pydantic AI, сопоставляя агентов, инструменты, состояние, события, workflow и границы deployment. Он также задаёт проверки поведения до удаления ADK.

Как скилл работает с графами и мультиагентными сценариями?

Простой детерминированный workflow предлагает оставить в async Python, а типизированные узлы и ветвления перенести в pydantic_graph. Для делегирования нужно учитывать режим collaboration и семантику передачи контекста.

Исходный текст

SKILL.md · MIT
---
name: migrating-google-adk-to-pydantic-ai
description: 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.
---

# Migrate Google ADK to Pydantic AI

Preserve caller-visible behavior, not ADK's class tree. Migrate the smallest complete request path and leave product infrastructure in the application.

## Work from the running application

1. Read repository instructions, dependencies, tests, and runtime entrypoints. Record the installed Google ADK, Pydantic AI, and optional `pydantic-ai-harness` versions.
2. Trace one real request from `Runner.run_async()` or the deployed endpoint through the root agent, instructions, collaboration mode, model calls, tools, workflow nodes, callbacks/plugins, session service, emitted events, state/artifact deltas, and final response. Record only behavior that path uses.
3. Separate the contracts before choosing targets:
   - `Session.events` used as model context;
   - session-, user-, app-, and invocation-scoped state;
   - searchable long-term memory;
   - workflow/node checkpoints and resume IDs;
   - versioned artifacts and external side effects.
4. Classify the active slice:
   - **Ordinary `LlmAgent`:** normally one reusable [`Agent`](https://pydantic.dev/docs/ai/core-concepts/agent/) with typed dependencies, tools, and output.
   - **ADK graph or dynamic workflow:** keep simple deterministic control flow in plain async Python; use [`pydantic_graph`](https://pydantic.dev/docs/ai/graph/graph/) when explicit typed nodes, branching, or graph inspection remain valuable.
   - **Multi-agent delegation:** inspect ADK's collaboration `mode` in Python 2.x; 1.x `sub_agents` use `chat` behavior. Use core [multi-agent patterns](https://pydantic.dev/docs/ai/guides/multi-agent-applications/) for `chat` transfer semantics. Harness [`SubAgents`](https://pydantic.dev/docs/ai/harness/subagents/) can fit `task` or `single_turn` only when their isolated context, return, interaction, and concurrency behavior match.
   - **Product runtime:** retain auth, session/state stores, artifact stores, queues, transport, A2A endpoints, evaluation, observability, and deployment unless they are explicitly in scope.
5. Add deterministic characterization tests, then migrate one vertical slice behind its existing caller boundary.
6. Run the original tests and focused parity tests. Mark unexercised behavior `unverified`; similar names are not equivalence evidence.

Read [Concept Mapping](references/CONCEPT-MAPPING.md) for the features the slice uses. Read [Semantic Gaps](references/SEMANTIC-GAPS.md) for workflows, state, resume, confirmation, callbacks/plugins, event streams, skills, or execution environments. Read [Verification and Cutover](references/VERIFICATION-AND-CUTOVER.md) before removing ADK or changing production traffic.

## High-risk gates

- Do not pass ADK `Session` objects or mutable state dictionaries through model-chosen tool arguments. Put authenticated identity and service clients in typed dependencies; persist product and workflow state through application-owned stores.
- [`message_history`](https://pydantic.dev/docs/ai/core-concepts/message-history/) continues model context. It does not replace ADK session state, memory, artifacts, event records, node checkpoints, or invocation resume.
- ADK resumability replays recorded node/tool results and can execute tools more than once. Choose a [durable execution](https://pydantic.dev/docs/ai/capabilities/durable_execution/overview/) design explicitly and prove restart plus idempotency for side effects.
- Keep conversational input, approval, and authorization distinct. Map tool confirmation to [deferred tool approval](https://pydantic.dev/docs/ai/tools-toolsets/deferred-tools/); keep identity and access checks in trusted application code.
- Preserve callback/plugin ordering and short-circuit rules deliberately. Pydantic AI hooks have their own capability ordering and exception-based skip/recovery semantics; a list of lookalike hooks is not parity.
- ADK partial events are delivered without applying state deltas; each non-partial event applies its delta when appended. Artifact writes happen during the artifact operation, before the current event records the returned version. If callers consume ADK event fields or final-event detection, retain a boundary adapter and test the exact stream and persistence order.
- Use Harness only for an observed reusable capability. Ordinary agents need core only, and a command allowlist is not an OS security boundary.

## Pydantic AI defaults

- Map `instruction` to `instructions`; use a `RunContext` instructions function when it depends on trusted runtime data.
- Map function tools to typed Pydantic AI tools. Preserve tool names, descriptions, validation behavior, error shape, retries, confirmation, and concurrency only where callers rely on them.
- Map `output_schema` to `output_type` when the terminal output contract is structured. Preserve an existing wire adapter if changing response shape would widen the migration.
- Persist [`ModelMessage`](https://pydantic.dev/docs/ai/core-concepts/message-history/) histories separately from workflow and product state. Reuse the application's current stores before adding a new persistence subsystem.
- Use [`Hooks`](https://pydantic.dev/docs/ai/core-concepts/hooks/) for local lifecycle interception or a custom capability for reusable policy that also owns tools, instructions, settings, or events.
- Keep the active model/provider unless changing it is requested. Use provider-prefixed Pydantic AI model IDs and verify provider-specific tools, settings, streaming, and realtime behavior against installed APIs.

## Completion

The slice is complete only when every observed caller contract is `preserved` by executable evidence, explicitly accepted as `changed`, or `not applicable`. Treat `unverified` and `blocked` contracts as unfinished. Do not remove `google-adk` while a retained runtime, session migration, deployment command, evaluation, or compatibility path still imports or invokes it.

© pydantic · MIT · pydantic/skills

Похожие скиллы

Все скиллы по теме «Настройка агента: память, контекст, субагенты» →
setup-matt-pocock-skills Matt Pocock Скилл настраивает репозиторий для инженерных скиллов Matt Pocock: задаёт трекер задач, метки триажа и расположение доменной документации. Запустите его перед первым использованием остальных скиллов. 1 052 851установок ask-matt Matt Pocock Помогает выбрать подходящий скилл или рабочий поток из набора Matt Pocock. Пригодится, когда непонятно, с чего начать задачу: от идеи до разбора бага. 766 587установок to-tickets Matt Pocock Разбивает план, спецификацию или переписку на небольшие сквозные задачи и отмечает, какие из них блокируют остальные. Пригодится, когда нужно согласовать порядок работы до публикации задач в трекере. 711 230установок writing-plans Jesse Vincent Скилл превращает требования к многошаговой задаче в подробный план реализации до начала работы с кодом. Пригодится, когда исполнителю нужно зафиксировать файлы, интерфейсы и проверки. CX Codex 282 859установок caveman-review JuliusBrussee Пишет замечания к коду одной строкой: место, проблема, исправление. Пригодится, когда ревью диффа или PR надо пройти быстро и без воды. CX Codex +1 411 800установок caveman-compress JuliusBrussee Сжимает CLAUDE.md, списки задач и другие текстовые файлы в краткий формат, сохраняя читаемую резервную копию. CX Codex +1 411 500установок

Из того же набора17

logfire-infrastructure Скилл настраивает OpenTelemetry Collector так, чтобы метрики хостов, контейнеров, Kubernetes и баз данных уходили в Pydantic Logfire без правок в коде приложения. CX Codex +1 532установок migrating-langchain-to-pydantic-ai Скилл для переноса Python-приложений с LangChain, LangGraph и Deep Agents на Pydantic AI. Пригодится, когда нужно сохранить поведение, а не форму фреймворка. CX Codex +1 314установок migrating-openai-agents-sdk-to-pydantic-ai Инструкция для постепенного перевода Python-приложений с OpenAI Agents SDK на Pydantic AI и Harness. Помогает сохранить публичный контракт вызовов, хендоффы и стриминг. CX Codex +1 308установок migrating-vercel-ai-sdk-and-eve-to-pydantic-ai Переводит приложения на TypeScript Vercel AI SDK или Eve на Python с Pydantic AI. Полезен, когда нужно сохранить поведение, а не API исходника. CX Codex +1 306установок migrating-claude-agent-sdk-to-pydantic-ai Скилл ведёт миграцию Python-приложения с Claude Agent SDK на Pydantic AI. Нужен, когда в коде есть импорт claude_agent_sdk. CX Codex +1 308установок migrating-pi-to-pydantic-ai Скилл помогает переписать TypeScript-агентов на базе Pi на Python с помощью Pydantic AI и Harness. Он пригодится при переносе расширений, сессий и инструментов. CX Codex +1 305установок migrating-mastra-to-pydantic-ai Скилл переносит TypeScript-приложения на Mastra в Python с Pydantic AI. Пригодится, когда код импортирует @mastra/* или использует агентов, инструменты и воркфлоу Mastra. CX Codex +1 304установок pydantic-ai Плагин подсказывает Claude, как писать агентов на Pydantic AI: шаблоны, деревья решений и разбор типичных ошибок. ★ 145звёзд репо

Спонсоры проекта

Компании, которые помогают держать аналитику открытой