본문으로 건너뛰기

AgentNetwork에서 다음으로 마이그레이션.network()

현재v0.20.0~을 위한@mastra/core, 다음 변경 사항이 적용됩니다.

AI SDK v4에서 v5로 업그레이드
AI SDK v4에서 v5로 업그레이드에 대한 직접 링크

  • 모든 Model 제공자 패키지를 메이저 버전으로 업그레이드하세요.
노트

이렇게 하면 이제 모든 Model이 v5 Model이 됩니다.

Memory가 필요합니다
Memory가 필요합니다에 대한 직접 링크

  • 이제 Agent 네트워크가 제대로 작동하려면 Memory가 필요합니다.
노트

Agent에 대한 Memory를 구성해야 합니다.

마이그레이션 경로
마이그레이션 경로에 대한 직접 링크

AgentNetwork 프리미티브를 사용 중이라면 AgentNetworkAgent로 교체할 수 있습니다. 전에:

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.')

후에:

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 프리미티브를 사용 중이라면 NewAgentNetworkAgent로 교체할 수 있습니다. 전에:

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.')

후에:

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.')