@mastra/mcp-docs-server 0.13.2-alpha.0 → 0.13.2-alpha.1
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%2Fagui.md +12 -0
- package/.docs/organized/changelogs/%40mastra%2Fastra.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fchroma.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-netlify.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-vercel.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +24 -24
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Ffirecrawl.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fgithub.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Flance.md +12 -0
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +21 -21
- package/.docs/organized/changelogs/%40mastra%2Fmcp-registry-registry.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fmcp.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fmem0.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fopensearch.md +11 -0
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +19 -19
- package/.docs/organized/changelogs/%40mastra%2Frag.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fragie.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fschema-compat.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fvoice-cloudflare.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fvoice-deepgram.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-elevenlabs.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-gladia.md +12 -0
- package/.docs/organized/changelogs/%40mastra%2Fvoice-google.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-murf.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fvoice-openai.md +14 -14
- package/.docs/organized/changelogs/%40mastra%2Fvoice-playai.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fvoice-sarvam.md +13 -13
- package/.docs/organized/changelogs/%40mastra%2Fvoice-speechify.md +14 -14
- package/.docs/organized/changelogs/create-mastra.md +7 -7
- package/.docs/organized/changelogs/mastra.md +27 -27
- package/.docs/organized/code-examples/a2a.md +1 -1
- package/.docs/organized/code-examples/agent-network.md +125 -7
- package/.docs/organized/code-examples/agent.md +1 -1
- package/.docs/organized/code-examples/agui.md +4 -4
- package/.docs/organized/code-examples/ai-sdk-useChat.md +6 -6
- package/.docs/organized/code-examples/assistant-ui.md +5 -5
- package/.docs/organized/code-examples/bird-checker-with-express.md +1 -1
- package/.docs/organized/code-examples/bird-checker-with-nextjs-and-eval.md +5 -5
- package/.docs/organized/code-examples/bird-checker-with-nextjs.md +5 -5
- package/.docs/organized/code-examples/client-side-tools.md +6 -6
- package/.docs/organized/code-examples/crypto-chatbot.md +4 -4
- package/.docs/organized/code-examples/experimental-auth-weather-agent.md +1 -1
- package/.docs/organized/code-examples/fireworks-r1.md +1 -1
- package/.docs/organized/code-examples/mcp-configuration.md +2 -2
- package/.docs/organized/code-examples/mcp-registry-registry.md +1 -1
- package/.docs/organized/code-examples/memory-per-resource-example.md +236 -0
- package/.docs/organized/code-examples/memory-with-mem0.md +1 -1
- package/.docs/organized/code-examples/memory-with-processors.md +1 -1
- package/.docs/organized/code-examples/openapi-spec-writer.md +5 -5
- package/.docs/organized/code-examples/quick-start.md +1 -1
- package/.docs/organized/code-examples/stock-price-tool.md +1 -1
- package/.docs/organized/code-examples/weather-agent.md +1 -1
- package/.docs/organized/code-examples/workflow-ai-recruiter.md +1 -1
- package/.docs/organized/code-examples/workflow-with-inline-steps.md +1 -1
- package/.docs/organized/code-examples/workflow-with-memory.md +1 -1
- package/.docs/organized/code-examples/workflow-with-separate-steps.md +1 -1
- package/.docs/raw/frameworks/agentic-uis/copilotkit.mdx +53 -10
- package/.docs/raw/mastra-cloud/dashboard.mdx +100 -0
- package/.docs/raw/mastra-cloud/observability.mdx +24 -138
- package/.docs/raw/mastra-cloud/overview.mdx +50 -42
- package/.docs/raw/mastra-cloud/setting-up.mdx +51 -87
- package/.docs/raw/memory/overview.mdx +4 -0
- package/.docs/raw/memory/working-memory.mdx +88 -1
- package/.docs/raw/observability/nextjs-tracing.mdx +2 -2
- package/.docs/raw/reference/storage/libsql.mdx +1 -0
- package/.docs/raw/reference/tools/vector-query-tool.mdx +1 -0
- package/.docs/raw/reference/workflows/sleep.mdx +43 -0
- package/.docs/raw/reference/workflows/sleepUntil.mdx +43 -0
- package/.docs/raw/reference/workflows/waitForEvent.mdx +49 -0
- package/.docs/raw/storage/overview.mdx +50 -1
- package/.docs/raw/tools-mcp/mcp-overview.mdx +52 -0
- package/.docs/raw/workflows/inngest-workflow.mdx +1 -1
- package/.docs/raw/workflows/pausing-execution.mdx +60 -0
- package/package.json +6 -6
- package/.docs/raw/mastra-cloud/deploying.mdx +0 -142
|
@@ -3,164 +3,50 @@ title: Observability in Mastra Cloud
|
|
|
3
3
|
description: Monitoring and debugging tools for Mastra Cloud deployments
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { MastraCloudCallout } from '@/components/mastra-cloud-callout'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
> Mastra Cloud is currently in **beta**.
|
|
8
|
+
# Understanding Tracing and Logs
|
|
10
9
|
|
|
11
|
-
Mastra Cloud
|
|
10
|
+
Mastra Cloud captures execution data to help you monitor your application's behavior in the production environment.
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
<MastraCloudCallout />
|
|
14
13
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
1. **Chat**: Interactive messaging interface to test your agent
|
|
18
|
-
2. **Traces**: Detailed execution records
|
|
19
|
-
3. **Evaluation**: Agent performance assessment
|
|
20
|
-
|
|
21
|
-

|
|
22
|
-
|
|
23
|
-
### Chat Interface
|
|
24
|
-
|
|
25
|
-
The Chat tab provides:
|
|
26
|
-
|
|
27
|
-
- Interactive messaging with deployed agents
|
|
28
|
-
- System response to user queries
|
|
29
|
-
- Suggested prompt buttons (e.g., "What capabilities do you have?")
|
|
30
|
-
- Message input area
|
|
31
|
-
- Branch indicator (e.g., "main")
|
|
32
|
-
- Note about agent memory limitations
|
|
33
|
-
|
|
34
|
-
### Agent Configuration Panel
|
|
35
|
-
|
|
36
|
-
The right sidebar displays agent details:
|
|
37
|
-
|
|
38
|
-
- Agent name and deployment identifier
|
|
39
|
-
- Model information (e.g., "OpenAI")
|
|
40
|
-
- Tools available to the agent (e.g., "getWeather")
|
|
41
|
-
- Complete system prompt text
|
|
42
|
-
|
|
43
|
-
This panel provides visibility into how the agent is configured without needing to check the source code.
|
|
44
|
-
|
|
45
|
-
## Trace System
|
|
46
|
-
|
|
47
|
-
Mastra Cloud records traces for agent and workflow interactions.
|
|
48
|
-
|
|
49
|
-
### Trace Explorer Interface
|
|
50
|
-
|
|
51
|
-

|
|
52
|
-
|
|
53
|
-
The Trace Explorer interface shows:
|
|
54
|
-
|
|
55
|
-
- All agent and workflow interactions
|
|
56
|
-
- Specific trace details
|
|
57
|
-
- Input and output data
|
|
58
|
-
- Tool calls with parameters and results
|
|
59
|
-
- Workflow execution paths
|
|
60
|
-
- Filtering options by type, status, timestamp, and agent/workflow
|
|
61
|
-
|
|
62
|
-
### Trace Data Structure
|
|
63
|
-
|
|
64
|
-
Each trace contains:
|
|
65
|
-
|
|
66
|
-
1. **Request Data**: The request that initiated the agent or workflow
|
|
67
|
-
2. **Tool Call Records**: Tool calls during execution with parameters
|
|
68
|
-
3. **Tool Response Data**: The responses from tool calls
|
|
69
|
-
4. **Agent Response Data**: The generated agent response
|
|
70
|
-
5. **Execution Timestamps**: Timing information for each execution step
|
|
71
|
-
6. **Model Metadata**: Information about model usage and tokens
|
|
72
|
-
|
|
73
|
-
The trace view displays all API calls and results throughout execution. This data helps debug tool usage and agent logic flows.
|
|
74
|
-
|
|
75
|
-
### Agent Interaction Data
|
|
76
|
-
|
|
77
|
-
Agent interaction traces include:
|
|
78
|
-
|
|
79
|
-
- User input text
|
|
80
|
-
- Agent processing steps
|
|
81
|
-
- Tool calls (e.g., weather API calls)
|
|
82
|
-
- Parameters and results for each tool call
|
|
83
|
-
- Final agent response text
|
|
84
|
-
|
|
85
|
-
## Dashboard Structure
|
|
86
|
-
|
|
87
|
-
The Mastra Cloud dashboard contains:
|
|
88
|
-
|
|
89
|
-
- Project deployment history
|
|
90
|
-
- Environment variable configuration
|
|
91
|
-
- Agent configuration details (model, system prompt, tools)
|
|
92
|
-
- Workflow step visualization
|
|
93
|
-
- Deployment URLs
|
|
94
|
-
- Recent activity log
|
|
95
|
-
|
|
96
|
-
## Agent Testing
|
|
97
|
-
|
|
98
|
-
Test your agents using the Chat interface:
|
|
99
|
-
|
|
100
|
-
1. Navigate to the Agents section
|
|
101
|
-
2. Select the agent you want to test
|
|
102
|
-
3. Use the Chat tab to interact with your agent
|
|
103
|
-
4. Send messages and view responses
|
|
104
|
-
5. Use suggested prompts for common queries
|
|
105
|
-
6. Switch to the Traces tab to view execution details
|
|
106
|
-
|
|
107
|
-
Note that by default, agents do not remember conversation history across sessions. The interface indicates this with the message: "Agent will not remember previous messages. To enable memory for agent see image."
|
|
14
|
+
## Logs
|
|
108
15
|
|
|
109
|
-
|
|
16
|
+
You can view detailed logs for debugging and monitoring your application's behavior on the [Logs](/docs/mastra-cloud/dashboard#logs) page of the Dashboard.
|
|
110
17
|
|
|
111
|
-

|
|
112
19
|
|
|
113
|
-
|
|
20
|
+
Key features:
|
|
114
21
|
|
|
115
|
-
|
|
116
|
-
- Status for each workflow step
|
|
117
|
-
- Execution details for each step
|
|
118
|
-
- Execution trace records
|
|
119
|
-
- Multi-step process execution (e.g., weather lookup followed by activity planning)
|
|
22
|
+
Each log entry includes its severity level and a detailed message showing agent, workflow, or storage activity.
|
|
120
23
|
|
|
121
|
-
|
|
24
|
+
## Traces
|
|
122
25
|
|
|
123
|
-
|
|
26
|
+
More detailed traces are available for both agents and workflows by using a [logger](/docs/observability/logging) or enabling [telemetry](/docs/observability/tracing) using one of our [supported providers](/reference/observability/providers).
|
|
124
27
|
|
|
125
|
-
|
|
28
|
+
### Agents
|
|
126
29
|
|
|
127
|
-
|
|
30
|
+
With a [logger](/docs/observability/logging) enabled, you can view detailed outputs from your agents in the **Traces** section of the Agents Playground.
|
|
128
31
|
|
|
129
|
-

|
|
130
33
|
|
|
131
|
-
|
|
34
|
+
Key features:
|
|
132
35
|
|
|
133
|
-
|
|
134
|
-
- **Level**: Log level (info, debug)
|
|
135
|
-
- **Hostname**: Server identification
|
|
136
|
-
- **Message**: Detailed log information, including:
|
|
137
|
-
- API initialization
|
|
138
|
-
- Storage connections
|
|
139
|
-
- Agent and workflow activity
|
|
36
|
+
Tools passed to the agent during generation are standardized using `convertTools`. This includes retrieving client-side tools, memory tools, and tools exposed from workflows.
|
|
140
37
|
|
|
141
|
-
## Technical Features
|
|
142
38
|
|
|
143
|
-
|
|
39
|
+
### Workflows
|
|
144
40
|
|
|
145
|
-
|
|
146
|
-
- **Structured Trace Format**: JSON format for filtering and query operations
|
|
147
|
-
- **Historical Data Storage**: Retention of past execution records
|
|
148
|
-
- **Deployment Version Links**: Correlation between traces and deployment versions
|
|
41
|
+
With a [logger](/docs/observability/logging) enabled, you can view detailed outputs from your workflows in the **Traces** section of the Workflows Playground.
|
|
149
42
|
|
|
150
|
-
|
|
43
|
+

|
|
151
44
|
|
|
152
|
-
|
|
153
|
-
- Use the chat interface to test edge case inputs
|
|
154
|
-
- View system prompts to understand agent behavior
|
|
155
|
-
- Examine tool call parameters and results
|
|
156
|
-
- Verify workflow execution step sequencing
|
|
157
|
-
- Identify execution bottlenecks in trace timing data
|
|
158
|
-
- Compare trace differences between agent versions
|
|
45
|
+
Key features:
|
|
159
46
|
|
|
160
|
-
|
|
47
|
+
Workflows are created using `createWorkflow`, which sets up steps, metadata, and tools. You can run them with `runWorkflow` by passing input and options.
|
|
161
48
|
|
|
162
|
-
|
|
49
|
+
## Next steps
|
|
163
50
|
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
- Join the [Discord developer channel](https://discord.gg/mastra)
|
|
51
|
+
- [Logging](/docs/observability/logging)
|
|
52
|
+
- [Tracing](/docs/observability/tracing)
|
|
@@ -3,61 +3,69 @@ title: Mastra Cloud
|
|
|
3
3
|
description: Deployment and monitoring service for Mastra applications
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
import { MastraCloudCallout } from '@/components/mastra-cloud-callout'
|
|
7
|
+
import { FileTree } from "nextra/components";
|
|
8
|
+
|
|
6
9
|
# Mastra Cloud
|
|
7
10
|
|
|
8
|
-
Mastra Cloud is a
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
[Mastra Cloud](https://mastra.ai/cloud) is a platform for deploying, managing, monitoring, and debugging Mastra applications. When you [deploy](/docs/mastra-cloud/setting-up) your application, Mastra Cloud exposes your agents, tools, and workflows as REST API endpoints.
|
|
12
|
+
|
|
13
|
+
<MastraCloudCallout />
|
|
14
|
+
|
|
15
|
+
## Platform features
|
|
16
|
+
|
|
17
|
+
Deploy and manage your applications with automated builds, organized projects, and no additional configuration.
|
|
18
|
+
|
|
19
|
+

|
|
20
|
+
|
|
21
|
+
Key features:
|
|
22
|
+
|
|
23
|
+
Mastra Cloud supports zero-config deployment, continuous integration with GitHub, and atomic deployments that package agents, tools, and workflows together.
|
|
11
24
|
|
|
12
|
-
|
|
13
|
-
> Mastra Cloud is currently in **public beta**. Features, APIs, and UIs may
|
|
14
|
-
> change as development continues.
|
|
25
|
+
## Project Dashboard
|
|
15
26
|
|
|
16
|
-
|
|
27
|
+
Monitor and debug your applications with detailed output logs, deployment state, and interactive tools.
|
|
17
28
|
|
|
18
|
-
|
|
19
|
-
- **Project Organization** - Group agents and workflows into projects with assigned URLs
|
|
20
|
-
- **Environment Variables** - Store configuration securely by environment
|
|
21
|
-
- **Testing Console** - Send messages to agents through a web interface
|
|
22
|
-
- **Execution Tracing** - Record agent interactions and tool calls
|
|
23
|
-
- **Workflow Visualization** - Display workflow steps and execution paths
|
|
24
|
-
- **Logs** - Standard logging output for debugging
|
|
25
|
-
- **Platform Compatibility** - Uses the same infrastructure as Cloudflare, Vercel, and Netlify deployers
|
|
29
|
+

|
|
26
30
|
|
|
27
|
-
|
|
31
|
+
Key features:
|
|
28
32
|
|
|
29
|
-
The
|
|
33
|
+
The Project Dashboard gives you an overview of your application's status and deployments, with access to logs and a built-in playground for testing agents and workflows.
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
- **Project Details** - Deployments, environment variables, and access URLs
|
|
33
|
-
- **Deployment History** - Record of deployments with timestamps and status
|
|
34
|
-
- **Agent Inspector** - Agent configuration view showing models, tools, and system prompts
|
|
35
|
-
- **Testing Console** - Interface for sending messages to agents
|
|
36
|
-
- **Trace Explorer** - Records of tool calls, parameters, and responses
|
|
37
|
-
- **Workflow Viewer** - Diagram of workflow steps and connections
|
|
35
|
+
## Project structure
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
Use a standard Mastra project structure for proper detection and deployment.
|
|
40
38
|
|
|
41
|
-
|
|
39
|
+
<FileTree>
|
|
40
|
+
<FileTree.Folder name="src" defaultOpen>
|
|
41
|
+
<FileTree.Folder name="mastra" defaultOpen>
|
|
42
|
+
<FileTree.Folder name="agents" defaultOpen>
|
|
43
|
+
<FileTree.File name="agent-name.ts" />
|
|
44
|
+
</FileTree.Folder>
|
|
45
|
+
<FileTree.Folder name="tools" defaultOpen>
|
|
46
|
+
<FileTree.File name="tool-name.ts" />
|
|
47
|
+
</FileTree.Folder>
|
|
48
|
+
<FileTree.Folder name="workflows" defaultOpen>
|
|
49
|
+
<FileTree.File name="workflow-name.ts" />
|
|
50
|
+
</FileTree.Folder>
|
|
51
|
+
<FileTree.File name="index.ts" />
|
|
52
|
+
</FileTree.Folder>
|
|
53
|
+
</FileTree.Folder>
|
|
54
|
+
<FileTree.File name="package.json" />
|
|
55
|
+
</FileTree>
|
|
42
56
|
|
|
43
|
-
|
|
44
|
-
- **Dynamic Resource Allocation** - Adjusts compute resources based on traffic
|
|
45
|
-
- **Mastra-specific Runtime** - Runtime optimized for agent execution
|
|
46
|
-
- **Standard Deployment API** - Consistent deployment interface across environments
|
|
47
|
-
- **Tracing Infrastructure** - Records all agent and workflow execution steps
|
|
57
|
+
Mastra Cloud scans your repository for:
|
|
48
58
|
|
|
49
|
-
|
|
59
|
+
- **Agents**: Defined using: `new Agent({...})`
|
|
60
|
+
- **Tools**: Defined using: `createTool({...})`
|
|
61
|
+
- **Workflows**: Defined using: `createWorkflow({...})`
|
|
62
|
+
- **Steps**: Defined using: `createStep({...})`
|
|
63
|
+
- **Environment Variables**: API keys and configuration variables
|
|
50
64
|
|
|
51
|
-
|
|
65
|
+
## Technical implementation
|
|
52
66
|
|
|
53
|
-
-
|
|
54
|
-
- Maintaining staging and production environments
|
|
55
|
-
- Monitoring agent behavior across many requests
|
|
56
|
-
- Testing agent responses through a web interface
|
|
57
|
-
- Deploying to multiple regions
|
|
67
|
+
Mastra Cloud is purpose-built for Mastra agents, tools, and workflows. It handles long-running requests, records detailed traces for every execution, and includes built-in support for evals.
|
|
58
68
|
|
|
59
|
-
##
|
|
69
|
+
## Next steps
|
|
60
70
|
|
|
61
|
-
|
|
62
|
-
2. [Deploy code](/docs/mastra-cloud/deploying)
|
|
63
|
-
3. [View execution traces](/docs/mastra-cloud/observability)
|
|
71
|
+
- [Setting Up and Deploying](/docs/mastra-cloud/setting-up)
|
|
@@ -3,126 +3,90 @@ title: Setting Up a Project
|
|
|
3
3
|
description: Configuration steps for Mastra Cloud projects
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { MastraCloudCallout } from '@/components/mastra-cloud-callout'
|
|
7
|
+
import { Steps } from "nextra/components";
|
|
7
8
|
|
|
8
|
-
|
|
9
|
-
> Mastra Cloud is currently in **beta**.
|
|
9
|
+
# Setting Up and Deploying
|
|
10
10
|
|
|
11
|
-
This page
|
|
11
|
+
This page explains how to set up a project on [Mastra Cloud](https://mastra.ai/cloud) with automatic deployments using our GitHub integration.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- A Mastra Cloud account
|
|
16
|
-
- A GitHub account
|
|
17
|
-
- A GitHub repository containing a Mastra application
|
|
13
|
+
<MastraCloudCallout />
|
|
18
14
|
|
|
19
|
-
##
|
|
20
|
-
|
|
21
|
-
1. **Sign in to Mastra Cloud**
|
|
15
|
+
## Prerequisites
|
|
22
16
|
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
- A [Mastra Cloud](https://mastra.ai/cloud) account
|
|
18
|
+
- A GitHub account / repository containing a Mastra application
|
|
25
19
|
|
|
26
|
-
|
|
20
|
+
> See our [Getting started](/docs/getting-started/installation) guide to scaffold out a new Mastra project with sensible defaults.
|
|
27
21
|
|
|
28
|
-
|
|
29
|
-
- This opens the GitHub repository import dialog
|
|
22
|
+
## Setup and Deploy process
|
|
30
23
|
|
|
31
|
-
|
|
24
|
+
<Steps>
|
|
32
25
|
|
|
33
|
-
|
|
26
|
+
### Sign in to Mastra Cloud
|
|
34
27
|
|
|
35
|
-
|
|
36
|
-
- Click the "Import" button next to the repository you want to deploy
|
|
28
|
+
Head over to [https://cloud.mastra.ai/](https://cloud.mastra.ai) and sign in with either:
|
|
37
29
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
- **Repo Name**: The GitHub repository name (read-only)
|
|
41
|
-
- **Project Name**: Customize the project name (defaults to repo name)
|
|
42
|
-
- **Branch**: Select the branch to deploy (dropdown, defaults to `main`)
|
|
43
|
-
- **Project root**: Set the root directory of your project (defaults to `/`)
|
|
44
|
-
- **Mastra Directory**: Specify where Mastra files are located (defaults to `src/mastra`)
|
|
45
|
-
- **Build Command**: Optional command to run during build process
|
|
46
|
-
- **Store Settings**: Configure data storage options
|
|
47
|
-
- **Environment Variables**: Add key-value pairs for configuration (e.g., API keys)
|
|
30
|
+
- **GitHub**
|
|
31
|
+
- **Google**
|
|
48
32
|
|
|
49
|
-
|
|
33
|
+
### Install the Mastra GitHub app
|
|
50
34
|
|
|
51
|
-
|
|
35
|
+
When prompted, install the Mastra GitHub app.
|
|
52
36
|
|
|
53
|
-
|
|
54
|
-
- **Workflows**: Workflow step definitions (e.g., weather-workflow)
|
|
55
|
-
- **Environment Variables**: Required API keys and configuration variables
|
|
37
|
+

|
|
56
38
|
|
|
57
|
-
|
|
39
|
+
### Create a new project
|
|
58
40
|
|
|
59
|
-
|
|
41
|
+
Click the **Create new project** button to create a new project.
|
|
60
42
|
|
|
61
|
-
|
|
43
|
+

|
|
62
44
|
|
|
63
|
-
###
|
|
45
|
+
### Import a Git repository
|
|
64
46
|
|
|
65
|
-
|
|
66
|
-
- **Domains**: URLs for accessing your deployed application
|
|
67
|
-
- Format: `https://[project-name].mastra.cloud`
|
|
68
|
-
- Format: `https://[random-id].mastra.cloud`
|
|
69
|
-
- **Status**: Current deployment status (success or archived)
|
|
70
|
-
- **Branch**: The branch deployed (typically `main`)
|
|
71
|
-
- **Environment Variables**: Configured API keys and settings
|
|
72
|
-
- **Workflows**: List of detected workflows with step counts
|
|
73
|
-
- **Agents**: List of detected agents with models and tools
|
|
74
|
-
- **Database Usage**: Reads, writes, and storage statistics
|
|
47
|
+
Search for a repository, then click **Import**.
|
|
75
48
|
|
|
76
|
-
|
|
49
|
+

|
|
77
50
|
|
|
78
|
-
|
|
79
|
-
- Deployment ID (based on commit hash)
|
|
80
|
-
- Status (success/archived)
|
|
81
|
-
- Branch
|
|
82
|
-
- Commit hash
|
|
83
|
-
- Timestamp
|
|
51
|
+
### Configure the deployment
|
|
84
52
|
|
|
85
|
-
|
|
53
|
+
Mastra Cloud automatically detects the right build settings, but you can customize them using the options described below.
|
|
86
54
|
|
|
87
|
-
|
|
55
|
+

|
|
88
56
|
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
57
|
+
- **Importing from GitHub**: The GitHub repository name
|
|
58
|
+
- **Project name**: Customize the project name
|
|
59
|
+
- **Branch**: The branch to deploy from
|
|
60
|
+
- **Project root**: The root directory of your project
|
|
61
|
+
- **Mastra directory**: Where Mastra files are located
|
|
62
|
+
- **Environment variables**: Add environment variables used by the application
|
|
63
|
+
- **Build and Store settings**:
|
|
64
|
+
- **Install command**: Runs pre-build to install project dependencies
|
|
65
|
+
- **Project setup command**: Runs pre-build to prepare any external dependencies
|
|
66
|
+
- **Port**: The network port the server will use
|
|
67
|
+
- **Store settings**: Use Mastra Cloud's built-in [LibSQLStore](/docs/storage/overview) storage
|
|
68
|
+
- **Deploy Project**: Starts the deployment process
|
|
96
69
|
|
|
97
|
-
|
|
70
|
+
### Deploy project
|
|
98
71
|
|
|
99
|
-
|
|
72
|
+
Click **Deploy Project** to create and deploy your application using the configuration you’ve set.
|
|
100
73
|
|
|
101
|
-
|
|
102
|
-
- **Deployments**: Deployment history and details
|
|
103
|
-
- **Logs**: Application logs for debugging
|
|
104
|
-
- **Agents**: List and configuration of all agents
|
|
105
|
-
- **Workflows**: List and structure of all workflows
|
|
106
|
-
- **Settings**: Project configuration options
|
|
74
|
+
</Steps>
|
|
107
75
|
|
|
108
|
-
##
|
|
76
|
+
## Successful deployment
|
|
109
77
|
|
|
110
|
-
|
|
78
|
+
After a successful deployment you'll be shown the **Overview** screen where you can view your project's status, domains, latest deployments and connected agents and workflows.
|
|
111
79
|
|
|
112
|
-
|
|
113
|
-
2. Go to the "Environment Variables" section
|
|
114
|
-
3. Add or edit variables (such as `OPENAI_API_KEY`)
|
|
115
|
-
4. Save the configuration
|
|
80
|
+

|
|
116
81
|
|
|
117
|
-
|
|
82
|
+
## Continuous integration
|
|
118
83
|
|
|
119
|
-
|
|
84
|
+
Your project is now configured with automatic deployments which occur whenever you push to the configured branch of your GitHub repository.
|
|
120
85
|
|
|
121
|
-
|
|
86
|
+
## Testing your application
|
|
122
87
|
|
|
123
|
-
|
|
124
|
-
2. The dashboard interface for direct interaction with agents
|
|
88
|
+
After a successful deployment you can test your agents and workflows from the [Playground](/docs/mastra-cloud/dashboard#playground) in Mastra Cloud, or interact with them using our [Client SDK](/docs/client-js/overview).
|
|
125
89
|
|
|
126
|
-
## Next
|
|
90
|
+
## Next steps
|
|
127
91
|
|
|
128
|
-
|
|
92
|
+
- [Navigating the Dashboard](/docs/mastra-cloud/dashboard)
|
|
@@ -8,6 +8,8 @@ The context window is the total information visible to the language model at any
|
|
|
8
8
|
|
|
9
9
|
In Mastra, context is broken up into three parts: system instructions and information about the user ([working memory](./working-memory.mdx)), recent messages ([message history](#conversation-history)), and older messages that are relevant to the user’s query ([semantic recall](./semantic-recall.mdx)).
|
|
10
10
|
|
|
11
|
+
Working memory can persist at different scopes - either per conversation thread (default) or across all threads for the same user (resource-scoped), enabling persistent user profiles that remember context across conversations.
|
|
12
|
+
|
|
11
13
|
In addition, we provide [memory processors](./memory-processors.mdx) to trim context or remove information if the context is too long.
|
|
12
14
|
|
|
13
15
|
## Quick Start
|
|
@@ -69,6 +71,8 @@ Mastra organizes memory into threads, which are records that identify specific c
|
|
|
69
71
|
1. **`threadId`**: A specific conversation id (e.g., `support_123`).
|
|
70
72
|
2. **`resourceId`**: The user or entity id that owns each thread (e.g., `user_123`, `org_456`).
|
|
71
73
|
|
|
74
|
+
The `resourceId` is particularly important for [resource-scoped working memory](./working-memory.mdx#resource-scoped-memory), which allows memory to persist across all conversation threads for the same user.
|
|
75
|
+
|
|
72
76
|
```typescript {2,3}
|
|
73
77
|
const response = await myMemoryAgent.stream("Hello, my name is Alice.", {
|
|
74
78
|
resourceId: "user_alice",
|
|
@@ -2,12 +2,19 @@ import YouTube from "@/components/youtube";
|
|
|
2
2
|
|
|
3
3
|
# Working Memory
|
|
4
4
|
|
|
5
|
-
While [conversation history](/docs/memory/overview#conversation-history) and [semantic recall](./semantic-recall.mdx) help agents remember conversations, working memory allows them to maintain persistent information about users across interactions
|
|
5
|
+
While [conversation history](/docs/memory/overview#conversation-history) and [semantic recall](./semantic-recall.mdx) help agents remember conversations, working memory allows them to maintain persistent information about users across interactions.
|
|
6
6
|
|
|
7
7
|
Think of it as the agent's active thoughts or scratchpad – the key information they keep available about the user or task. It's similar to how a person would naturally remember someone's name, preferences, or important details during a conversation.
|
|
8
8
|
|
|
9
9
|
This is useful for maintaining ongoing state that's always relevant and should always be available to the agent.
|
|
10
10
|
|
|
11
|
+
Working memory can persist at two different scopes:
|
|
12
|
+
- **Thread-scoped** (default): Memory is isolated per conversation thread
|
|
13
|
+
- **Resource-scoped**: Memory persists across all conversation threads for the same user
|
|
14
|
+
|
|
15
|
+
**Important:** Switching between scopes means the agent won't see memory from the other scope - thread-scoped memory is completely separate from resource-scoped memory.
|
|
16
|
+
|
|
17
|
+
|
|
11
18
|
## Quick Start
|
|
12
19
|
|
|
13
20
|
Here's a minimal example of setting up an agent with working memory:
|
|
@@ -38,6 +45,85 @@ Working memory is a block of Markdown text that the agent is able to update over
|
|
|
38
45
|
|
|
39
46
|
<YouTube id="ik-ld_XA96s" />
|
|
40
47
|
|
|
48
|
+
## Memory Persistence Scopes
|
|
49
|
+
|
|
50
|
+
Working memory can operate in two different scopes, allowing you to choose how memory persists across conversations:
|
|
51
|
+
|
|
52
|
+
### Thread-Scoped Memory (Default)
|
|
53
|
+
|
|
54
|
+
By default, working memory is scoped to individual conversation threads. Each thread maintains its own isolated memory:
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
const memory = new Memory({
|
|
58
|
+
storage,
|
|
59
|
+
options: {
|
|
60
|
+
workingMemory: {
|
|
61
|
+
enabled: true,
|
|
62
|
+
scope: 'thread', // Default - memory is isolated per thread
|
|
63
|
+
template: `# User Profile
|
|
64
|
+
- **Name**:
|
|
65
|
+
- **Interests**:
|
|
66
|
+
- **Current Goal**:
|
|
67
|
+
`,
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Use cases:**
|
|
74
|
+
- Different conversations about separate topics
|
|
75
|
+
- Temporary or session-specific information
|
|
76
|
+
- Workflows where each thread needs working memory but threads are ephemeral and not related to each other
|
|
77
|
+
|
|
78
|
+
### Resource-Scoped Memory
|
|
79
|
+
|
|
80
|
+
Resource-scoped memory persists across all conversation threads for the same user (resourceId), enabling persistent user memory:
|
|
81
|
+
|
|
82
|
+
```typescript
|
|
83
|
+
const memory = new Memory({
|
|
84
|
+
storage,
|
|
85
|
+
options: {
|
|
86
|
+
workingMemory: {
|
|
87
|
+
enabled: true,
|
|
88
|
+
scope: 'resource', // Memory persists across all user threads
|
|
89
|
+
template: `# User Profile
|
|
90
|
+
- **Name**:
|
|
91
|
+
- **Location**:
|
|
92
|
+
- **Interests**:
|
|
93
|
+
- **Preferences**:
|
|
94
|
+
- **Long-term Goals**:
|
|
95
|
+
`,
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
**Use cases:**
|
|
102
|
+
- Personal assistants that remember user preferences
|
|
103
|
+
- Customer service bots that maintain customer context
|
|
104
|
+
- Educational applications that track student progress
|
|
105
|
+
|
|
106
|
+
### Usage with Agents
|
|
107
|
+
|
|
108
|
+
When using resource-scoped memory, make sure to pass the `resourceId` parameter:
|
|
109
|
+
|
|
110
|
+
```typescript
|
|
111
|
+
// Resource-scoped memory requires resourceId
|
|
112
|
+
const response = await agent.generate("Hello!", {
|
|
113
|
+
threadId: "conversation-123",
|
|
114
|
+
resourceId: "user-alice-456" // Same user across different threads
|
|
115
|
+
});
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Storage Adapter Support
|
|
119
|
+
|
|
120
|
+
Resource-scoped working memory requires specific storage adapters that support the `mastra_resources` table:
|
|
121
|
+
|
|
122
|
+
### ✅ Supported Storage Adapters
|
|
123
|
+
- **LibSQL** (`@mastra/libsql`)
|
|
124
|
+
- **PostgreSQL** (`@mastra/pg`)
|
|
125
|
+
- **Upstash** (`@mastra/upstash`)
|
|
126
|
+
|
|
41
127
|
## Custom Templates
|
|
42
128
|
|
|
43
129
|
Templates guide the agent on what information to track and update in working memory. While a default template is used if none is provided, you'll typically want to define a custom template tailored to your agent's specific use case to ensure it remembers the most relevant information.
|
|
@@ -161,3 +247,4 @@ instructions on _how_ and _when_ to use this template in your agent's `instructi
|
|
|
161
247
|
|
|
162
248
|
- [Streaming working memory](/examples/memory/streaming-working-memory)
|
|
163
249
|
- [Using a working memory template](/examples/memory/streaming-working-memory-advanced)
|
|
250
|
+
- [Per-resource working memory](https://github.com/mastra-ai/mastra/tree/main/examples/memory-per-resource-example) - Complete example showing resource-scoped memory persistence
|
|
@@ -59,7 +59,7 @@ npm install @opentelemetry/api langfuse-vercel
|
|
|
59
59
|
import {
|
|
60
60
|
NodeSDK,
|
|
61
61
|
ATTR_SERVICE_NAME,
|
|
62
|
-
|
|
62
|
+
resourceFromAttributes,
|
|
63
63
|
} from "@mastra/core/telemetry/otel-vendor";
|
|
64
64
|
import { LangfuseExporter } from "langfuse-vercel";
|
|
65
65
|
|
|
@@ -69,7 +69,7 @@ export function register() {
|
|
|
69
69
|
});
|
|
70
70
|
|
|
71
71
|
const sdk = new NodeSDK({
|
|
72
|
-
resource:
|
|
72
|
+
resource: resourceFromAttributes({
|
|
73
73
|
[ATTR_SERVICE_NAME]: "ai",
|
|
74
74
|
}),
|
|
75
75
|
traceExporter: exporter,
|
|
@@ -67,4 +67,5 @@ The storage implementation handles schema creation and updates automatically. It
|
|
|
67
67
|
|
|
68
68
|
- `threads`: Stores conversation threads
|
|
69
69
|
- `messages`: Stores individual messages
|
|
70
|
+
- `resources`: Stores user-specific data for resource-scoped working memory
|
|
70
71
|
- `metadata`: Stores additional metadata for threads and messages
|
|
@@ -539,6 +539,7 @@ runtimeContext.set("filter", { category: "docs" });
|
|
|
539
539
|
runtimeContext.set("databaseConfig", {
|
|
540
540
|
pinecone: { namespace: "runtime-namespace" }
|
|
541
541
|
});
|
|
542
|
+
runtimeContext.set("model", openai.embedding("text-embedding-3-small"));
|
|
542
543
|
|
|
543
544
|
const response = await agent.generate(
|
|
544
545
|
"Find documentation from the knowledge base.",
|