> Discover all available pages from the documentation index: https://mastra.zisheng.pro/ja/llms.txt # AgentNetwork から `.network()` へ移行する `@mastra/core` の `v0.20.0` 以降では、以下の変更が適用されます。 ## AI SDK v4 から v5 へアップグレードする - すべてのモデル Provider パッケージをメジャーバージョンアップしてください。 > **注記:** これにより、すべて v5 モデルになります。 ## Memory が必須に - Agent Network を正しく動作させるには、Memory が必要になりました。 > **注記:** Agent に Memory を設定する必要があります。 ## 移行方法 `AgentNetwork` プリミティブを使用していた場合は、`AgentNetwork` を `Agent` に置き換えます。 変更前: ```typescript import { AgentNetwork } from '@mastra/core/network' const agent = new AgentNetwork({ name: 'agent-network', agents: [agent1, agent2], tools: { tool1, tool2 }, model: 'openai/gpt-5.6-sol', instructions: 'You are a network agent that can help users with a variety of tasks.', }) await agent.stream('Find me the weather in Tokyo.') ``` 変更後: ```typescript import { Agent } from '@mastra/core/agent' import { Memory } from '@mastra/memory' const memory = new Memory() const agent = new Agent({ id: 'agent-network', name: 'agent-network', agents: { agent1, agent2 }, tools: { tool1, tool2 }, model: 'openai/gpt-5.6-sol', instructions: 'You are a network agent that can help users with a variety of tasks.', memory, }) await agent.network('Find me the weather in Tokyo.') ``` `NewAgentNetwork` プリミティブを使用していた場合は、`NewAgentNetwork` を `Agent` に置き換えます。 変更前: ```typescript import { NewAgentNetwork } from '@mastra/core/network/vnext' const agent = new NewAgentNetwork({ id: 'agent-network', name: 'agent-network', agents: { agent1, agent2 }, workflows: { workflow1 }, tools: { tool1, tool2 }, model: 'openai/gpt-5.6-sol', instructions: 'You are a network agent that can help users with a variety of tasks.', }) await agent.loop('Find me the weather in Tokyo.') ``` 変更後: ```typescript import { Agent } from '@mastra/core/agent' import { Memory } from '@mastra/memory' const memory = new Memory() const agent = new Agent({ id: 'agent-network', name: 'agent-network', agents: { agent1, agent2 }, workflows: { workflow1 }, tools: { tool1, tool2 }, model: 'openai/gpt-5.6-sol', instructions: 'You are a network agent that can help users with a variety of tasks.', memory, }) await agent.network('Find me the weather in Tokyo.') ```