@mastra/mcp-docs-server 0.13.22-alpha.5 → 0.13.22-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.docs/organized/changelogs/%40mastra%2Fagent-builder.md +10 -0
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +30 -30
- package/.docs/organized/changelogs/%40mastra%2Fcouchbase.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +22 -22
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Flance.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Floggers.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +11 -11
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +23 -23
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google-gemini-live.md +9 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai-realtime.md +10 -10
- package/.docs/organized/changelogs/create-mastra.md +7 -7
- package/.docs/organized/changelogs/mastra.md +18 -18
- package/.docs/organized/code-examples/agui.md +1 -1
- package/.docs/organized/code-examples/ai-sdk-useChat.md +2 -2
- package/.docs/organized/code-examples/ai-sdk-v5.md +2 -2
- package/.docs/organized/code-examples/assistant-ui.md +2 -2
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +2 -2
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +2 -2
- package/.docs/organized/code-examples/client-side-tools.md +1 -1
- package/.docs/organized/code-examples/crypto-chatbot.md +4 -4
- package/.docs/organized/code-examples/openapi-spec-writer.md +2 -2
- package/.docs/raw/frameworks/agentic-uis/cedar-os.mdx +7 -7
- package/CHANGELOG.md +10 -0
- package/package.json +8 -8
- package/.docs/raw/reference/networks/agent-network.mdx +0 -165
- /package/.docs/raw/reference/streaming/{MastraModelOutput.mdx → agents/MastraModelOutput.mdx} +0 -0
- /package/.docs/raw/reference/streaming/{stream.mdx → agents/stream.mdx} +0 -0
- /package/.docs/raw/reference/streaming/{streamVNext.mdx → agents/streamVNext.mdx} +0 -0
- /package/.docs/raw/reference/{workflows/run-methods → streaming/workflows}/stream.mdx +0 -0
- /package/.docs/raw/reference/{workflows/run-methods → streaming/workflows}/streamVNext.mdx +0 -0
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "AgentNetwork (Experimental)"
|
|
3
|
-
description: "Reference documentation for the AgentNetwork class"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# AgentNetwork (Experimental)
|
|
7
|
-
|
|
8
|
-
> **Note:** The AgentNetwork feature is experimental and may change in future releases.
|
|
9
|
-
|
|
10
|
-
The `AgentNetwork` class provides a way to create a network of specialized agents that can collaborate to solve complex tasks. Unlike Workflows, which require explicit control over execution paths, AgentNetwork uses an LLM-based router to dynamically determine which agent to call next.
|
|
11
|
-
|
|
12
|
-
## Key Concepts
|
|
13
|
-
|
|
14
|
-
- **LLM-based Routing**: AgentNetwork exclusively uses an LLM to figure out the best way to use your agents
|
|
15
|
-
- **Agent Collaboration**: Multiple specialized agents can work together to solve complex tasks
|
|
16
|
-
- **Dynamic Decision Making**: The router decides which agent to call based on the task requirements
|
|
17
|
-
|
|
18
|
-
## Usage
|
|
19
|
-
|
|
20
|
-
```typescript
|
|
21
|
-
import { AgentNetwork } from "@mastra/core/network";
|
|
22
|
-
import { openai } from "@mastra/openai";
|
|
23
|
-
|
|
24
|
-
// Create specialized agents
|
|
25
|
-
const webSearchAgent = new Agent({
|
|
26
|
-
name: "Web Search Agent",
|
|
27
|
-
instructions: "You search the web for information.",
|
|
28
|
-
model: openai("gpt-4o"),
|
|
29
|
-
tools: {
|
|
30
|
-
/* web search tools */
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
const dataAnalysisAgent = new Agent({
|
|
35
|
-
name: "Data Analysis Agent",
|
|
36
|
-
instructions: "You analyze data and provide insights.",
|
|
37
|
-
model: openai("gpt-4o"),
|
|
38
|
-
tools: {
|
|
39
|
-
/* data analysis tools */
|
|
40
|
-
},
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// Create the network
|
|
44
|
-
const researchNetwork = new AgentNetwork({
|
|
45
|
-
name: "Research Network",
|
|
46
|
-
instructions: "Coordinate specialized agents to research topics thoroughly.",
|
|
47
|
-
model: openai("gpt-4o"),
|
|
48
|
-
agents: [webSearchAgent, dataAnalysisAgent],
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
// Use the network
|
|
52
|
-
const result = await researchNetwork.generate(
|
|
53
|
-
"Research the impact of climate change on agriculture",
|
|
54
|
-
);
|
|
55
|
-
console.log(result.text);
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
## Constructor
|
|
59
|
-
|
|
60
|
-
```typescript
|
|
61
|
-
constructor(config: AgentNetworkConfig)
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Parameters
|
|
65
|
-
|
|
66
|
-
- `config`: Configuration object for the AgentNetwork
|
|
67
|
-
- `name`: Name of the network
|
|
68
|
-
- `instructions`: Instructions for the routing agent
|
|
69
|
-
- `model`: Language model to use for routing
|
|
70
|
-
- `agents`: Array of specialized agents in the network
|
|
71
|
-
|
|
72
|
-
## Methods
|
|
73
|
-
|
|
74
|
-
### generate()
|
|
75
|
-
|
|
76
|
-
Generates a response using the agent network. This method has replaced the deprecated `run()` method for consistency with the rest of the codebase.
|
|
77
|
-
|
|
78
|
-
```typescript
|
|
79
|
-
async generate(
|
|
80
|
-
messages: string | string[] | CoreMessage[],
|
|
81
|
-
args?: AgentGenerateOptions
|
|
82
|
-
): Promise<GenerateTextResult>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### stream()
|
|
86
|
-
|
|
87
|
-
Streams a response using the agent network.
|
|
88
|
-
|
|
89
|
-
```typescript
|
|
90
|
-
async stream(
|
|
91
|
-
messages: string | string[] | CoreMessage[],
|
|
92
|
-
args?: AgentStreamOptions
|
|
93
|
-
): Promise<StreamTextResult>
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### getRoutingAgent()
|
|
97
|
-
|
|
98
|
-
Returns the routing agent used by the network.
|
|
99
|
-
|
|
100
|
-
```typescript
|
|
101
|
-
getRoutingAgent(): Agent
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
### getAgents()
|
|
105
|
-
|
|
106
|
-
Returns the array of specialized agents in the network.
|
|
107
|
-
|
|
108
|
-
```typescript
|
|
109
|
-
getAgents(): Agent[]
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
### getAgentHistory()
|
|
113
|
-
|
|
114
|
-
Returns the history of interactions for a specific agent.
|
|
115
|
-
|
|
116
|
-
```typescript
|
|
117
|
-
getAgentHistory(agentId: string): Array<{
|
|
118
|
-
input: string;
|
|
119
|
-
output: string;
|
|
120
|
-
timestamp: string;
|
|
121
|
-
}>
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
### getAgentInteractionHistory()
|
|
125
|
-
|
|
126
|
-
Returns the history of all agent interactions that have occurred in the network.
|
|
127
|
-
|
|
128
|
-
```typescript
|
|
129
|
-
getAgentInteractionHistory(): Record<
|
|
130
|
-
string,
|
|
131
|
-
Array<{
|
|
132
|
-
input: string;
|
|
133
|
-
output: string;
|
|
134
|
-
timestamp: string;
|
|
135
|
-
}>
|
|
136
|
-
>
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### getAgentInteractionSummary()
|
|
140
|
-
|
|
141
|
-
Returns a formatted summary of agent interactions in chronological order.
|
|
142
|
-
|
|
143
|
-
```typescript
|
|
144
|
-
getAgentInteractionSummary(): string
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
## When to Use AgentNetwork vs Workflows
|
|
148
|
-
|
|
149
|
-
- **Use AgentNetwork when:** You want the AI to figure out the best way to use your agents, with dynamic routing based on the task requirements.
|
|
150
|
-
|
|
151
|
-
- **Use Workflows when:** You need explicit control over execution paths, with predetermined sequences of agent calls and conditional logic.
|
|
152
|
-
|
|
153
|
-
## Internal Tools
|
|
154
|
-
|
|
155
|
-
The AgentNetwork uses a special `transmit` tool that allows the routing agent to call specialized agents. This tool handles:
|
|
156
|
-
|
|
157
|
-
- Single agent calls
|
|
158
|
-
- Multiple parallel agent calls
|
|
159
|
-
- Context sharing between agents
|
|
160
|
-
|
|
161
|
-
## Limitations
|
|
162
|
-
|
|
163
|
-
- The AgentNetwork approach may use more tokens than a well-designed Workflow for the same task
|
|
164
|
-
- Debugging can be more challenging as the routing decisions are made by the LLM
|
|
165
|
-
- Performance may vary based on the quality of the routing instructions and the capabilities of the specialized agents
|
/package/.docs/raw/reference/streaming/{MastraModelOutput.mdx → agents/MastraModelOutput.mdx}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|