Pydantic AI に Crusoe がネイティブモデルプロバイダーとして追加
本文の状態
日本語全文を表示中
詳細モードで約8分の本文を読めます。
同じ出来事の情報源
この情報源を基点に整理
Pydantic Blog
Crusoe は Pydantic AI のネイティブプロバイダーとなり、開発者が複雑な設定なしで同社のインテリジェンスファクトリー上のオープンモデルを直接利用可能になった。
AI深層分析を開く2026年8月14日 21:55
AI深層分析
キーポイント
Pydantic AI へのネイティブ統合
Crusoe は Pydantic AI の公式プロバイダーとして追加され、ストリーミングやツール呼び出しなどの機能を標準でサポートするようになった。
設定の簡素化とモデルプロファイル
従来の手動設定やカスタムベース URL が必要なくなり、各モデルファミリーごとの JSON スキーマや出力形式を正しく扱うプロファイルがフレームワークに組み込まれる。
広範なオープンモデルのサポート
GLM, Llama, DeepSeek, Qwen などの主要なオープンウェイトモデルに加え、NVIDIA Nemotron™ 3 シリーズも即日サポート対象として提供される。
自動プロファイル推論と明示的制御
Crusoe はモデルファミリーに基づいて自動的に適切な Pydantic AI プロファイルを推論するが、必要に応じて CrusoeProvider を直接構築して明示的な制御も可能である。
エージェントワークロードに最適化されたインフラ
Cluster-wide KV cache fabric である MemoryAlloy がシステムプロンプトや履歴の再送信をキャッシュ処理することで、コンテキストが成長してもループコストを抑える。
重要な引用
Crusoe is now a native model provider in Pydantic AI.
A native provider removes all of that. The endpoint, the key handling, and the per-family profiles ship in the framework.
Nothing in this stack locks you in.
MemoryAlloy, our cluster-wide KV cache fabric, routes requests cache-aware, which matters for agents that re-send system prompts and accumulated history on every turn.
編集コメントを表示
編集コメント
Crusoe が Pydantic AI のネイティブプロバイダーとなることで、オープンモデルの運用における開発者の負担が軽減される。これは、オープンソースフレームワークとインフラストラクチャの連携を強化する重要な一歩と言える。
Source Article
元記事を日本語で読む
本文に関係しない購読案内、埋め込み通知、サイト内プロモーションは除いています。
以下は、Crusoe のシニア・デベロッパー・リレーションズ・マネージャーであるエマニュエル・アチェンプン氏による寄稿記事です。Pydantic のデベロッパー・リレーションズ担当者であるライス・カルヴァーロ氏との共著です。
Crusoe は now、Pydantic AI のネイティブモデルプロバイダーとなりました。'crusoe:zai/GLM-5.2' という文字列を指定するだけで、エージェントは Crusoe Managed Inference 上で動作します。ストリーミング処理、ツール呼び出し、構造化出力、そして Crusoe Intelligence Foundry 上のオープンモデルカタログ全体が、そのまま利用可能です。
本記事では、Crusoe の概要、この連携を構築した理由、およびその使い方を解説します。
なぜこれを構築したのか
Crusoe は、どのような形で AI を構築するかにかかわらず、AI に特化したクラウドです。オープンモデルはその重要な一部であり、それらに最適化されたインフラストラクチャが必要です。Crusoe Managed Inference は、Crusoe Intelligence Foundry 上で GLM、Llama、DeepSeek、Qwen、Gemma、gpt-oss、Kimi、NVIDIA Nemotron™ 3 ファミリといったオープンモデルカタログをエンドツーエンドでサポートします。新リリースには即日対応も可能です。
オープンウェイトの提供は業務の半分です。残りの半分は、開発者がすでに使用しているオープンソースツールの中で出会えるようにすることです。Crusoe は LiteLLM のアップストリームプロバイダーであり、現在は Pydantic AI のネイティブプロバイダーでもあります。各連携では同じ原則を遵循しています。コードをアップストリームに貢献し、維持管理を行い、設定はフレームワーク自体の規約に任せるのです。
このスタックにはロックインはありません。モデルはオープンウェイト、フレームワークはオープンソースです。本記事で説明するプロバイダーは Crusoe SDK ではなく、pydantic-ai リポジトリ内に存在します。オープンとクローズドが互いに牽引し合うことでエコシステムが強固になり、開発者は各ワークロードに最適なモデルを選定できます。これが私たちが目指す成果です。
課題
すでに多くのチームが Pydantic AI エージェントを Crusoe で実行していました。動作はしましたが、OpenAIProvider にカスタム base_url を設定し、API キーを手動で管理する必要があり、その過程でモデルプロファイルの推論機能を失っていました。モデルプロファイルは、名前よりも重要です。これは Pydantic AI に対し、各モデルファミリーが JSON スキーマやツール定義、出力フォーマットをどのように扱うかを伝えます。汎用的な OpenAI プロバイダーを GLM や gpt-oss モデルに指向させると、OpenAI のデフォルト設定が適用されますが、それが常に最適とは限りません。
ネイティブプロバイダーはこれらすべてを解消します。エンドポイント、キー管理、各ファミリーごとのプロファイルがフレームワーク内に統合されています。
仕組み
本統合では、他の OpenAI 互換プロバイダーと同じパターンに従い、pydantic-ai に CrusoeProvider を追加します。Pydantic AI または openai グループを含む軽量パッケージをインストールしてください:
uv add logfire "pydantic-ai-slim[openai]"
Intelligence Foundry の Crusoe Cloud コンソールでキーを生成し、以下のように設定します:
export CRUSOE_API_KEY="cr_..."
これがセットアップのすべてです。省略形文字列が残りの処理を担当します:
import logfire
from pydantic_ai import Agent
logfire.configure()
logfire.instrument_pydantic_ai()
agent = Agent('crusoe:zai/GLM-5.2')
result = agent.run_sync('In one sentence: why do open agent stacks matter in 2026?')
print(result.output)
構造化された出力は、Pydantic AI で期待される通りの動作をします。これはプロバイダーがモデルファミリーに最適なプロファイルを自動的に推論するためです。
import logfire
from pydantic import BaseModel
from pydantic_ai import Agent
logfire.configure()
logfire.instrument_pydantic_ai()
class GpuSpec(BaseModel):
name: str
memory_gb: int
interconnect: str
agent = Agent('crusoe:zai/GLM-5.2', output_type=GpuSpec)
result = agent.run_sync('Summarize the NVIDIA HGX™ B200 as a spec.')
print(result.output)
#> name='NVIDIA HGX B200' memory_gb=1536 interconnect='5th-Gen NVLink (1.8 TB/s per GPU), PCIe Gen5'
明示的な制御が必要な場合は、プロバイダーを自分で構築することも可能です。
import logfire
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.crusoe import CrusoeProvider
logfire.configure()
logfire.instrument_pydantic_ai()
model = OpenAIChatModel(
'meta-llama/Llama-3.3-70B-Instruct',
provider=CrusoeProvider(api_key='your-api-key'),
)
agent = Agent(model)
result = agent.run_sync('Be concise. Defend the Oxford comma.')
print(result.output)
このプロバイダーは、カスタムの httpx.AsyncClient または事前に設定された AsyncOpenAI クライアントも受け付けるため、既存の接続プーリングやプロキシ設定に柔軟に対応できます。
内部では、CrusoeProvider がサポートするモデルファミリーをそれぞれの正しい Pydantic AI プロファイルにマッピングします。具体的には、meta-llama、deepseek-ai、qwen、google (Gemma)、moonshotai (Kimi)、zai (GLM)、そして openai (gpt-oss は harmony プロファイルを使用) です。ツールスキーマや JSON 出力は、各ファミリーごとに正しく動作し、ユーザー側での追加設定は一切不要です。明示的なプロファイルが定義されていないファミリーについては、OpenAI 互換のデフォルト値に自動的にフォールバックします。
#Results and learnings
この組み合わせから得られるのは、一見シンプルながら裏側に多くの仕組みを備えたリストです。Pydantic AI が提供するエージェントフレームワークには、型安全な出力、ツール機能、ストリーミング対応、そして Pydantic Evals を通じた評価や、Pydantic Logfire による追跡機能が含まれています。一方、Crusoe はエージェントの負荷に特化した推論レイヤーを提供します。クラスタ全体の KV キャッシュファブリックである MemoryAlloy が、リクエストをキャッシュを意識してルーティングします。これは、各ターンでシステムプロンプトや蓄積された履歴を再送信する必要があるエージェントにとって特に重要です。入力データに対するキャッシュ価格設定により、コンテキストが拡大してもループの処理コストを抑えられます。
このプロバイダー構築から得た主な教訓は、Pydantic AI における OpenAI 互換パターンの設計が非常に洗練されている点です。統合全体は、単一のプロバイダークラスとプロファイルマップ、そして既存の Nebius プロバイダーを模倣したテストで構成されています。OpenAI 互換エンドポイントの背後にオープンモデルを提供している場合、プロバイダーの追加は週末のプロジェクトとして完結します。さらに、メンテナーによるレビュープロセスが、元のコードよりも優れた結果をもたらしてくれます。
#Try it
2 つのステップで始められます。まず Intelligence Foundry からキーを取得し、次に uv add logfire "pydantic-ai-slim[openai]" を実行して、Crusoe のカタログにある任意のモデルを指す Agent を設定します。
最初の Agent が実行されると、Pydantic AI のドキュメントでは、run_sync 実行後に何ができるかが解説されています。具体的にはツール、ストリーミング、依存関係の注入、そしてマルチエージェントフローです。
上記のすべての例で logfire.configure() を呼び出しています。これは Pydantic Logfire で、各実行をモデル呼び出し、ツールの呼び出し、リトライ、トークンコストなどを含むトレースに変換します。このトレースは SQL で照会可能で、ブラウザ上で開いて詳細を確認できます。Pydantic AI の統合ドキュメントには設定方法が記載されており、無料プランでも最初の Agent が動作する様子を追跡するには十分です。
カタログ内のモデルを切り替えて、その変更が性能向上につながったかどうかを確認したい場合は、Pydantic Evals を活用するのがおすすめです。
このスタックで面白いものを構築したら、ぜひ教えてください。Crusoe の開発者コミュニティは devcommunity@crusoedev.ai までご連絡ください。また、モデルのリリースやクックブックの公開、その他のウォークスルーについては、LinkedIn で「Crusoe for Developers」をフォローするか、X(旧 Twitter)で @crusoedev をフォローしてください。
検証機能をコアに据え、その下に Agent 向けに最適化された推論機能を持つエージェントフレームワーク。これが私たちが自らのために使いたかったスタックであり、そのため私たちはこれを組み込みました。
原文を表示
_The following is a guest post from Crusoe, written by Emmanuel Acheampong, Senior Developer Relations Manager. Co-authored by Laís Carvalho, Developer Relations at Pydantic.
Crusoe is now a native model provider in Pydantic AI. One string, 'crusoe:zai/GLM-5.2', and your agents run on Crusoe Managed Inference: streaming, tool calling, structured output, and the full open model catalog on the Crusoe Intelligence Foundry, all out of the box.
This post covers who we are, why we built the integration, and how to use it.
#Why we built this
Crusoe is the cloud for AI, however you build it. Open models are a fast-growing part of that picture, and they deserve infrastructure built for them. Crusoe Managed Inference serves the open catalog end to end on the Crusoe Intelligence Foundry: GLM, Llama, DeepSeek, Qwen, Gemma, gpt-oss, Kimi, and the NVIDIA Nemotron™ 3 family, with day-zero support for new releases.
Serving open weights is half of that work. The other half is meeting developers in the open source tools they already use. Crusoe is an upstream provider in LiteLLM and now a native Pydantic AI provider. Each integration follows the same principle: contribute the code upstream, keep it maintained, and let the framework's own conventions handle configuration.
Nothing in this stack locks you in. The models are open weights, the frameworks are open source, and the provider described in this post lives in the pydantic-ai repository, not in a Crusoe SDK. The ecosystem gets stronger when open and closed keep pushing each other forward, and builders match each workload to the right model. That is the outcome we are investing in.
#The problem
Plenty of teams were already running Pydantic AI agents against Crusoe. It worked, but it meant wiring up OpenAIProvider with a custom base_url, managing the API key by hand, and losing model profile inference along the way. Model profiles matter more than they sound: they tell Pydantic AI how each model family handles JSON schemas, tool definitions, and output formats. Point a generic OpenAI provider at a GLM or gpt-oss model and you get OpenAI defaults, which are not always the right ones.
A native provider removes all of that. The endpoint, the key handling, and the per-family profiles ship in the framework.
#How it works
The integration adds a CrusoeProvider to pydantic-ai, following the same pattern as other OpenAI-compatible providers. Install Pydantic AI, or the slim package with the openai group:
uv add logfire "pydantic-ai-slim[openai]"
Generate a key in the Crusoe Cloud console under Intelligence Foundry, then set it:
export CRUSOE_API_KEY="cr_..."
That is the whole setup. The shorthand string does the rest:
import logfire
from pydantic_ai import Agent
logfire.configure()
logfire.instrument_pydantic_ai()
agent = Agent('crusoe:zai/GLM-5.2')
result = agent.run_sync('In one sentence: why do open agent stacks matter in 2026?')
print(result.output)
Structured output works the way you would expect from Pydantic AI, because the provider infers the right profile for the model family:
import logfire
from pydantic import BaseModel
from pydantic_ai import Agent
logfire.configure()
logfire.instrument_pydantic_ai()
class GpuSpec(BaseModel):
name: str
memory_gb: int
interconnect: str
agent = Agent('crusoe:zai/GLM-5.2', output_type=GpuSpec)
result = agent.run_sync('Summarize the NVIDIA HGX™ B200 as a spec.')
print(result.output)
#> name='NVIDIA HGX B200' memory_gb=1536 interconnect='5th-Gen NVLink (1.8 TB/s per GPU), PCIe Gen5'
If you need explicit control, construct the provider yourself:
import logfire
from pydantic_ai import Agent
from pydantic_ai.models.openai import OpenAIChatModel
from pydantic_ai.providers.crusoe import CrusoeProvider
logfire.configure()
logfire.instrument_pydantic_ai()
model = OpenAIChatModel(
'meta-llama/Llama-3.3-70B-Instruct',
provider=CrusoeProvider(api_key='your-api-key'),
)
agent = Agent(model)
result = agent.run_sync('Be concise. Defend the Oxford comma.')
print(result.output)
The provider also accepts a custom httpx.AsyncClient or a preconfigured AsyncOpenAI client, so it fits whatever connection pooling or proxy setup you already run.
Under the hood, CrusoeProvider maps the supported model families to their correct Pydantic AI profiles: meta-llama, deepseek-ai, qwen, google (Gemma), moonshotai (Kimi), zai (GLM), and openai (gpt-oss, which uses the harmony profile). Tool schemas and JSON output behave correctly per family without any configuration on your side. Families without an explicit profile fall back to OpenAI-compatible defaults.
#Results and learnings
What you get from the pairing is a short list with a lot behind it. Pydantic AI brings the agent framework: type-safe outputs, tools, streaming, and evals through Pydantic Evals, with tracing through Pydantic Logfire. Crusoe brings the inference layer built for agent workloads. MemoryAlloy, our cluster-wide KV cache fabric, routes requests cache-aware, which matters for agents that re-send system prompts and accumulated history on every turn. Cached input pricing means the loop stays cheap as contexts grow.
The main learning from building the provider: the OpenAI-compatible pattern in Pydantic AI is well factored. The whole integration is one provider class, a profile map, and tests that mirror the existing Nebius provider. If you serve open models behind an OpenAI-compatible endpoint, contributing a provider is a weekend project, and the maintainers' review process makes the result better than what you started with.
#Try it
Two steps: grab a key from the Intelligence Foundry, then uv add logfire "pydantic-ai-slim[openai]" and point an Agent at crusoe: plus any model in the catalog.
Once that first agent runs:
The Pydantic AI documentation covers what comes after a single run_sync: tools, streaming, dependency injection, and multi-agent flows.
Every example above calls logfire.configure(). That is Pydantic Logfire, and it turns each run into a trace you can open: model calls, tool calls, retries, and token costs, queryable with SQL. The Pydantic AI integration docs cover the setup, and the free tier is enough to watch your first agents work.
Pydantic Evals is worth reaching for when you start swapping models in the catalog and need to know whether the swap made things better.
If you build something interesting on this stack, we would love to hear about it. Reach the Crusoe developer community at devcommunity@crusoe.ai, and follow Crusoe for Developers on LinkedIn and @crusoedev on X for model launches, cookbook drops, and more walkthroughs.
An agent framework with validation at its core, and inference built for agents underneath it. That is the stack we wanted to use ourselves, so we wired it in.
関連記事
今日のまとめ
AIデイリーブリーフで今日の重要ニュースをまとめ読み