migrating-agno-to-pydantic-ai

Migrate Python Agno applications to Pydantic AI and, only when needed, Pydantic AI Harness. Use when source code imports `agno` or relies on Agno agents, teams, workflows, sessions, memory, knowledge, tools, hooks, guardrails, approvals, skills, streaming, or AgentOS.

Install
npx skills add 'https://github.com/pydantic/pydantic-ai/tree/main/pydantic_ai_slim/pydantic_ai/.agents/skills/migrating-agno-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/RESEARCH-AND-MAPPING.md

references/RESEARCH-AND-MAPPING.mdBrowse 4 files
View on GitHub
← Back to SKILL.md

Research and concept mapping

Use this reference conditionally after tracing the source path. It is a decision guide, not a requirement to reproduce the entire Agno platform.

Primary documentation

Inspect installed versions before migrating because Agno, Pydantic AI, and Harness continue to evolve.

Ownership map

Observed Agno behaviorTarget owner and likely seamFocused proof
Agent.run() / arun() and RunOutput.content, messages, metrics, or referencesCore: Agent.run() / run_sync(), AgentRunResult; Application: response adapterAssert caller-visible output, required trajectory fields, usage, errors, and side effects.
stream=True, stream_events=True, background streaming, or resumed event streamsCore: run_stream(), run_stream_events(), event_stream_handler, or iter(); Application: event/cursor adapterAssert reconstruction, order, stable fields, terminal detection, cancellation, reconnect/resume behavior, and no duplicate output.
Instructions, model, retries, reasoning, and call optionsCore: instructions, model/provider settings, retries, and UsageLimits; Application: configuration mappingConstruct every configured branch and assert limits/defaults actually consumed by the slice.
dependencies, RunContext, user_id, session_id, and metadata interpolationCore: typed deps_type, RunContext.deps, dynamic instructions/tool preparation; Application: authenticated context constructionInspect tool schemas and prove identity, credentials, stores, and services cannot be model-selected.
Functions, Function, Toolkit, MCP tools, and tool-choice restrictionsCore: typed tools, Tool, function toolsets, MCPToolset, preparation capabilitiesAssert names, schemas, return shape, error/retry behavior, timeout, concurrency, and effects.
output_schema, output_model, parser, or second structuring modelCore: Pydantic output type and explicit NativeOutput, ToolOutput, PromptedOutput, or TextOutput where transport mattersAssert valid output, invalid-output retries/errors, and preserve any second-model pass explicitly.
Pre-hooks, post-hooks, and tool hooksCore: Hooks, custom capability hooks, output validators, or toolset wrappers; Harness: ToolGuardrail when a tool-hook policy matches; Application: public error/event adapterGolden-test firing point, input mutation, short-circuit, order, retries, exceptions, persistence, and streaming visibility.
Input/output guardrailsHarness: matching InputGuardrail or OutputGuardrail; Core: output validators or custom capability when lifecycle differsExercise allow, block, replace/redact, retry, parallel execution, and caller-visible error/event shape.
Database-backed session messages and summariesCore: normalized messages; Application: existing store, ownership, retention, summary policy, and record migrationContinue in a fresh process, test incomplete tool calls and store errors, and reject cross-user/session access.
session_state, agentic state tools, or state interpolationApplication/Graph: typed state store; Core: dependencies provide trusted access, tools expose only intended mutationsAssert merge/overwrite policy, concurrent writes, namespace, prompt injection, and restart independently of messages.
User memories and learningHarness: Memory only when a model-owned namespaced notebook fits; otherwise Application: retain the memory/learning serviceAssert write trigger, schema, retrieval/injection, update/delete policy, tenant scope, bounds, and fresh-process continuation.
Knowledge bases, readers, embedders, vector DBs, filters, and referencesApplication: existing retrieval service behind dependencies or a tool; Core: tool call and resultAssert ingestion separately from query ranking, filters, citation shape, tenancy, failure behavior, and freshness.
Session summary, history window, compressionCore/Harness: history processing or an observed matching compaction strategy; Application: persisted summary contractAssert exactly what context survives, when summary runs, failure fallback, cost, and continuation. Do not equate generic compaction with memory.
Team delegation to membersHarness: SubAgents for isolated model-directed tasks; Core: agent-as-tool or programmatic delegation; Application/Graph: other collaboration modesAssert member selection, input/history isolation, shared context, result handback, aggregation, events, budgets, cancellation, and recursion.
Team coordinate/route/broadcast/tasks modesApplication/Graph unless a focused Harness composition proves the observed semanticsAssert routing, fan-out concurrency, merge order, leader/member retries, partial failure, and public result/event shape.
Fixed sequential workflowApplication: plain typed async functions; Graph: pydantic_graph when graph inspection adds valueAssert step inputs/outputs, order, error propagation, and terminal status.
Conditions, routers, loops, parallel steps, and custom workflow functionsApplication/Graph: explicit Python control flow and typed graph stateAssert chosen route, loop stop, join shape, source ordering, concurrency limit, cancellation, and partial failure.
Workflow session state, pause/resume, checkpoints, and persisted stepsApplication or durable engine: workflow state and progress; Core durable integration: agent operations inside that workflowKill and restart at each promised boundary; validate resume payload, step identity, lineage, and idempotent effects. Graph state alone is not persistence.
Tool confirmationCore: requires_approval, ApprovalRequired, or ApprovalRequiredToolset; inline HandleDeferredToolCalls or later DeferredToolResults; Application: policy, UI, audit, persistenceExercise deny/approve and prove zero effects before or after denial and exactly one after approval.
User-input pausesApplication: collect and validate conversational input; resume with explicit message or application stateAssert prompt/request shape, timeout/cancel, correlation, duplicate input, restart, and how input enters model context.
External tool executionApplication: execute the pending validated request; Core: deferred result resumes the agentPersist the complete request, authorize executor, assert result/error mapping and exactly-once effect policy.
Agno SkillsHarness: Skills for SKILL.md instructions; FileSystem, Shell, or Application tools for observed resources/scriptsAssert configured discovery, on-demand selection, every required reference/resource, trust, and script permissions separately.
AgentOS API, auth, sessions, control plane, registry, config, telemetry, and deploymentApplication/infrastructureExercise retained routes/jobs including auth, tenancy, wire shape, scaling, and failures.
AgentOS interfaces such as AG-UI, A2A, Slack, or WhatsAppCore UI adapters where protocol fits; Application: transport and authRun protocol fixtures or end-to-end tests; do not infer parity from having another UI adapter.
Evals, cases/suites, judges, and metricsEvals (pydantic_evals): cases, datasets, evaluators; Application: scheduling and score storageAdd the separate dependency, compare essential metrics on the same cases, and separately prove live sampling/persistence.
OpenTelemetry and Agno tracingCore: instrumentation/OpenTelemetry; optional Logfire; Application: existing backend and adaptersAssert trace correlation, content/privacy policy, required spans, retention, dashboards, and alerts before switching.
File, shell, browser, code execution, or broad Agno toolkit catalogHarness: matching focused capabilities such as Coder, FileSystem, Shell, browser capabilities, or ModalSandbox; Application: retained integrationsAssert only tools the slice uses, plus workspace effects, timeouts, output limits, credentials, and real containment when required.
Referenced from SKILL.md