Pydantic AI および Pydantic AI Harness(必要に応じて)へ、Python の LangChain、LangGraph、Deep Agents アプリケーションを移行させます。 **次のような場合に使用:** - LangChain エージェント、チェーン、LCEL(LangChain の構成フレームワーク)の移行 - LangGraph グラフの直接的な移行 - 永続化(データ保存)、割り込み、ストリーミング機能が必要なプロジェクト - `create_deep_agent` で構築されたプロジェクト(計画機能、ファイルシステム、サンドボックス(実行環境の隔離)バックエンドを含む) - スキル、メモリ、サブエージェント、権限管理、承認フロー、Deep Agents Code hosts を備えたプロジェクト
Migrate Python LangChain, LangGraph, or Deep Agents applications to Pydantic AI and, when the source uses harness features, Pydantic AI Harness. Use for LangChain agents, chains, LCEL, direct LangGraph graphs, persistence, interrupts, streaming, and `create_deep_agent` projects with planning, filesystem or sandbox backends, skills, memory, subagents, permissions, approvals, or Deep Agents Code hosts.
動作を保持する。フレームワークの形ではなく。動作的に完全な最小単位のスライスを移行し、そのスライスの外側のアプリケーション基盤は変更しないままにする。LangChain、LangGraph、Deep Agents は一つのソースエコシステム(出発元となる関連フレームワークの集合); Pydantic AI、pydantic_graph、Pydantic AI Harness は対応するターゲットエコシステムであり、このスキルはこれら全体にわたってマッピングする。
リポジトリの説明、依存関係ファイル、テスト、実際の実行ポイント(エントリポイント)を読む。インストールされている LangChain、LangGraph、Deep Agents、Pydantic AI、Harness のバージョンを特定する。
代表的な一つのリクエストをプロンプト、検索、モデル呼び出し、ツール呼び出し、状態、永続化、割り込み、出力イベント、トレース・メトリクスのコールバック、公開結果を通して追跡する。移行対象のコンポーネントを呼び出すすべての上位呼び出し元と兄弟エンドポイント(同じレベルの他の機能)を検査する; スライスが狭くても複数の公開インターフェイス(契約)を持つことができる。呼び出し元が実際に使用する同期・非同期・コールバック・ストリーミング形式とキーワード引数の名前を含める。それらのパスが実際に使う契約だけを記録する。
最も低コストな有用なベースラインを実行する。移行対象の範囲が広いか不明確な場合、依存関係ファイルとソースコードで langchain、langgraph、langsmith、deepagents を検索し、インポート、ファクトリ(生成関数)、呼び出し箇所に照らして確認する。create_deep_agent がどこから来るかを解決する: アップストリームパッケージと、その契約を複製した内部コピーの両方が Deep Agents としてカウントされる。
ターゲットを選択する前にスライスを分類する:
pydantic_ai.Agent を使用する。pydantic_graph を使用する。永続化(データの保存)は別の設計判断として扱う。create_deep_agent はファイルツール、シェル実行、サブエージェント委譲、要約、スキル、メモリ、権限、プロンプトキャッシング、承認ミドルウェア(承認処理)を LangChain エージェントループの上にまとめ、ハーネスプロフィール(設定)はさらに多くの機能を追加または非表示にできる。LangChain マッピングでループを移行し、スライスが実際に使用する各種バンドル機能を Harness 機能、コアプリミティブ(基本要素)、またはアプリケーションサービスにマッピングする(Deep Agents Mapping 参照)。アプリケーションコードが決して言及しない暗黙のデフォルトを把握する。決定論的な特性化テスト(動作確認テスト)を追加または保存し、既存の公開境界の後ろで一つの垂直スライスを移行する。
元のテストと焦点を当てた同等性テスト(パリティテスト)を実行する。 観察された各契約を根拠で分類する; ハッピーパスやトレース形状が似ているというだけの理由で、移行を一対一だと説明してはならない。
検出されたソース機能については Concept Mapping を読む。スライスに deepagents が含まれている場合は常に Deep Agents Mapping を読む。Semantic Gaps は、状態、ミドルウェア、リトライ(再試行)、承認、並行処理、ストリーミング、または同じように見える API が異なる可能性がある他の動作についてのみ読む。具体的なギャップが特定された後に Workaround Recipes を使用する; 必須チェックリストではない。観測可能性を追加するとき、ソースとターゲットの実行を比較するとき、またはセマンティックな違いをデバッグするときは Logfire Verification を読む。本番環境への切り替え前に Verification and Cutover を読む。
観察されたソース契約に直接相当するものがない場合、重要な設計判断を下す前にそれをユーザーに説明する。ソースの動作、提案される Pydantic AI 設計がどのように異なるか、ユーザーに見える、または運用上の影響、利用可能な選択肢を述べる。一つのオプションを推奨し、その残存リスク(残った問題)に名前を付ける。これを比例配分する: 通常のインポートや命名の変更をセマンティック警告に変えてはならない。
「非サポート」で止まってはならない。何も直接マッピングしない場合、既存のコアまたは Harness コンポジション、狭いアダプタまたはアプリケーションサービス、公開プリミティブから構築された新機能、またはコア変更を、その優先順でお勧めする。オプションが動作、アーキテクチャ、公開 API、またはスコープを本質的に変更する場合のみ質問する。
deepagents 依存関係だけでは何も変わらない。アクティブなスライスが create_deep_agent を呼び出すか、その計画、ファイルシステム、サンドボックス、スキル、メモリ、サブエージェント、権限、デプロイメント契約に依存する場合、それらはスコープ内の機能であり、Harness またはアプリケーションのオーナーであり、停止する理由ではない。ファイル、サンドボックス、権限、サブエージェント、バックグラウンド作業はチェックポイント付きグラフと同じ台帳および再開義務を持つ。Agent を決定論的 LCEL または pydantic_graph をすべての StateGraph に強制してはならない。pydantic-ai-harness を追加する: 計画、ワークスペースファイル、シェルまたはサンドボックス実行、Agent Skills、メモリノートブック、リポジトリコンテキスト、モデル指向サブエージェント、モデル非依存圧縮、ツール出力制限、ガードレール(制限)、支出制限、またはステップ永続化。機能を一度に一つ追加し、各機能をそのオーナー公開サブモジュールからインポートし、pydantic_ai_harness.experimental.* をバージョン依存として扱い、ターゲット環境でインポートおよび構築スモークテスト(基本動作確認)を実行する。Harness はコアエージェントループに構成される; それは第二のランタイムではなく、アプリケーション基盤を置き換えない。pydantic-ai-slim を優先し、その広い統合が実際に必要なときは完全な配布を使用する。覚えている例に合わせるだけの理由で古いリリースをピン留めしてはならない。Preserve behavior, not framework shape. Migrate the smallest behaviorally complete slice and leave application infrastructure outside that slice unchanged. LangChain, LangGraph, and Deep Agents are one source ecosystem; Pydantic AI, pydantic_graph, and Pydantic AI Harness are the matching target ecosystem, and this skill maps across all of it.
langchain, langgraph, langsmith, and deepagents, then confirm findings against imports, factories, and call sites. Resolve where create_deep_agent comes from: the upstream package and a vendored copy that reproduces its contracts both count as Deep Agents.pydantic_ai.Agent with typed dependencies, tools, and outputs.pydantic_graph when explicit typed nodes and branching remain useful. Treat persistence as a separate design decision.create_deep_agent bundles file tools, shell execution, subagent delegation, summarization, skills, memory, permissions, prompt caching, and approval middleware on top of the LangChain agent loop, and a harness profile can add or hide more. Migrate the loop with the LangChain mappings, then map each bundled feature the slice actually uses to a Harness capability, a core primitive, or an application service with Deep Agents Mapping. Inventory implicit defaults the application code never mentions.Read Concept Mapping for the detected source features. Read Deep Agents Mapping whenever deepagents is in the slice. Read Semantic Gaps only for state, middleware, retries, approval, concurrency, streaming, or other behavior where similar-looking APIs may differ. Use Workaround Recipes after a concrete gap is identified, not as a mandatory checklist. Read Logfire Verification when adding observability, comparing source and target runs, or debugging a semantic difference. Read Verification and Cutover before a production cutover.
When an observed source contract has no direct equivalent, explain it to the user before making a consequential design choice. State the source behavior, how the proposed Pydantic AI design differs, the user-visible or operational impact, and the available choices. Recommend one option and name its residual risk. Keep this proportional: do not turn ordinary import or naming changes into semantic warnings.
Do not stop at "unsupported." When nothing maps directly, recommend an existing core or Harness composition, a narrow adapter or application service, a new capability built from public primitives, or a core change, in that order of preference. Ask before choosing only when the options materially change behavior, architecture, public API, or scope.
deepagents dependency alone changes nothing. When the active slice calls create_deep_agent or depends on its planning, filesystem, sandbox, skills, memory, subagent, permission, or deployment contracts, those are in-scope features with Harness or application owners, not a reason to stop. Files, sandboxes, permissions, subagents, and background work carry the same ledger and restart obligations as checkpointed graphs.Agent onto deterministic LCEL or pydantic_graph onto every StateGraph.pydantic-ai-harness only for observed harness behavior: planning, workspace files, shell or sandboxed execution, Agent Skills, memory notebooks, repository context, model-directed subagents, model-agnostic compaction, tool-output limits, guardrails, spend limits, or step persistence. Add capabilities one at a time, import each from its owning public submodule, treat pydantic_ai_harness.experimental.* as version-sensitive, and run an import-and-construction smoke test in the target environment. Harness composes onto the core agent loop; it is not a second runtime and does not replace application infrastructure.pydantic-ai-slim with only the required provider and integration extras when the dependency surface is bounded, and use the full distribution when its broader integrations are actually needed. Do not pin an older release merely to match a remembered example.The slice is complete when every observed contract is either preserved by an executable check, intentionally changed by an accepted decision, or explicitly not applicable. An untested contract is unverified, not equivalent; an unresolved requested contract is unfinished work, not completion evidence. Constrain the slice or ask the user to accept the deferral. Remove LangChain, LangGraph, or Deep Agents dependencies only after no retained path needs them.
原文・著作権は Anthropic および各プラグイン作者に帰属します。日本語訳は Claude API による自動翻訳です。