@mastra/mcp-docs-server 1.0.0-beta.13 → 1.0.0-beta.15
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 +27 -27
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +78 -78
- package/.docs/organized/changelogs/%40mastra%2Fclickhouse.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +173 -173
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare-d1.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fcloudflare.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +248 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +338 -338
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +33 -33
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +41 -41
- package/.docs/organized/changelogs/%40mastra%2Fdynamodb.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fevals.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Ffastembed.md +6 -0
- package/.docs/organized/changelogs/%40mastra%2Flance.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Flibsql.md +195 -195
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +139 -139
- package/.docs/organized/changelogs/%40mastra%2Fmongodb.md +219 -219
- package/.docs/organized/changelogs/%40mastra%2Fmssql.md +219 -219
- package/.docs/organized/changelogs/%40mastra%2Fpg.md +235 -235
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +102 -102
- package/.docs/organized/changelogs/%40mastra%2Frag.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Freact.md +77 -70
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +218 -218
- package/.docs/organized/changelogs/%40mastra%2Fupstash.md +195 -195
- package/.docs/organized/changelogs/create-mastra.md +13 -13
- package/.docs/organized/changelogs/mastra.md +56 -56
- package/.docs/organized/code-examples/agent-v6.md +210 -0
- package/.docs/organized/code-examples/ai-elements.md +1 -1
- package/.docs/organized/code-examples/client-side-tools.md +1 -1
- package/.docs/raw/agents/adding-voice.mdx +10 -6
- package/.docs/raw/agents/agent-approval.mdx +5 -6
- package/.docs/raw/agents/agent-memory.mdx +22 -30
- package/.docs/raw/agents/guardrails.mdx +60 -50
- package/.docs/raw/agents/networks.mdx +8 -12
- package/.docs/raw/agents/overview.mdx +39 -23
- package/.docs/raw/agents/processors.mdx +20 -19
- package/.docs/raw/agents/structured-output.mdx +11 -7
- package/.docs/raw/agents/using-tools.mdx +4 -5
- package/.docs/raw/deployment/mastra-server.mdx +3 -3
- package/.docs/raw/deployment/overview.mdx +7 -1
- package/.docs/raw/deployment/web-framework.mdx +4 -6
- package/.docs/raw/deployment/workflow-runners.mdx +14 -0
- package/.docs/raw/evals/custom-scorers.mdx +9 -6
- package/.docs/raw/evals/overview.mdx +3 -6
- package/.docs/raw/evals/running-in-ci.mdx +2 -2
- package/.docs/raw/getting-started/manual-install.mdx +20 -20
- package/.docs/raw/getting-started/mcp-docs-server.mdx +2 -2
- package/.docs/raw/getting-started/studio.mdx +1 -1
- package/.docs/raw/guides/agent-frameworks/ai-sdk.mdx +4 -4
- package/.docs/raw/guides/build-your-ui/ai-sdk-ui.mdx +30 -30
- package/.docs/raw/guides/build-your-ui/assistant-ui.mdx +8 -8
- package/.docs/raw/guides/build-your-ui/copilotkit.mdx +11 -11
- package/.docs/raw/guides/deployment/amazon-ec2.mdx +9 -9
- package/.docs/raw/guides/deployment/aws-lambda.mdx +11 -11
- package/.docs/raw/guides/deployment/azure-app-services.mdx +2 -2
- package/.docs/raw/guides/deployment/cloudflare-deployer.mdx +5 -6
- package/.docs/raw/guides/deployment/digital-ocean.mdx +10 -10
- package/.docs/raw/guides/deployment/index.mdx +1 -1
- package/.docs/raw/guides/deployment/inngest.mdx +444 -0
- package/.docs/raw/guides/deployment/netlify-deployer.mdx +4 -4
- package/.docs/raw/guides/deployment/vercel-deployer.mdx +5 -6
- package/.docs/raw/guides/getting-started/astro.mdx +292 -451
- package/.docs/raw/guides/getting-started/express.mdx +7 -7
- package/.docs/raw/guides/getting-started/hono.mdx +18 -18
- package/.docs/raw/guides/getting-started/next-js.mdx +19 -20
- package/.docs/raw/guides/getting-started/quickstart.mdx +4 -4
- package/.docs/raw/guides/getting-started/sveltekit.mdx +238 -409
- package/.docs/raw/guides/getting-started/vite-react.mdx +21 -21
- package/.docs/raw/guides/guide/ai-recruiter.mdx +10 -10
- package/.docs/raw/guides/guide/chef-michel.mdx +9 -11
- package/.docs/raw/guides/guide/notes-mcp-server.mdx +15 -15
- package/.docs/raw/guides/guide/research-assistant.mdx +13 -13
- package/.docs/raw/guides/guide/stock-agent.mdx +5 -5
- package/.docs/raw/guides/guide/web-search.mdx +8 -8
- package/.docs/raw/guides/guide/whatsapp-chat-bot.mdx +7 -7
- package/.docs/raw/guides/migrations/ai-sdk-v4-to-v5.mdx +2 -2
- package/.docs/raw/guides/migrations/upgrade-to-v1/agent.mdx +1 -1
- package/.docs/raw/guides/migrations/upgrade-to-v1/memory.mdx +11 -3
- package/.docs/raw/guides/migrations/upgrade-to-v1/processors.mdx +11 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/storage.mdx +41 -0
- package/.docs/raw/guides/migrations/upgrade-to-v1/workflows.mdx +0 -2
- package/.docs/raw/guides/migrations/vnext-to-standard-apis.mdx +21 -23
- package/.docs/raw/index.mdx +2 -2
- package/.docs/raw/mastra-cloud/deployment.mdx +39 -0
- package/.docs/raw/mastra-cloud/observability.mdx +9 -15
- package/.docs/raw/mastra-cloud/overview.mdx +14 -44
- package/.docs/raw/mastra-cloud/setup.mdx +64 -0
- package/.docs/raw/mastra-cloud/studio.mdx +35 -0
- package/.docs/raw/mcp/overview.mdx +31 -13
- package/.docs/raw/mcp/publishing-mcp-server.mdx +2 -2
- package/.docs/raw/memory/memory-processors.mdx +9 -9
- package/.docs/raw/memory/message-history.mdx +69 -0
- package/.docs/raw/memory/overview.mdx +34 -76
- package/.docs/raw/memory/semantic-recall.mdx +58 -49
- package/.docs/raw/memory/storage.mdx +188 -0
- package/.docs/raw/memory/working-memory.mdx +7 -7
- package/.docs/raw/observability/logging.mdx +9 -10
- package/.docs/raw/observability/overview.mdx +0 -1
- package/.docs/raw/observability/tracing/bridges/otel.mdx +2 -2
- package/.docs/raw/observability/tracing/exporters/default.mdx +3 -3
- package/.docs/raw/observability/tracing/exporters/langfuse.mdx +1 -2
- package/.docs/raw/observability/tracing/overview.mdx +23 -25
- package/.docs/raw/observability/tracing/processors/sensitive-data-filter.mdx +3 -3
- package/.docs/raw/rag/chunking-and-embedding.mdx +6 -6
- package/.docs/raw/rag/graph-rag.mdx +7 -7
- package/.docs/raw/rag/overview.mdx +1 -1
- package/.docs/raw/rag/retrieval.mdx +21 -22
- package/.docs/raw/rag/vector-databases.mdx +22 -22
- package/.docs/raw/reference/agents/agent.mdx +3 -3
- package/.docs/raw/reference/agents/generate.mdx +1 -1
- package/.docs/raw/reference/agents/generateLegacy.mdx +2 -2
- package/.docs/raw/reference/agents/getDefaultGenerateOptions.mdx +2 -2
- package/.docs/raw/reference/agents/getDefaultOptions.mdx +2 -2
- package/.docs/raw/reference/agents/getDefaultStreamOptions.mdx +2 -2
- package/.docs/raw/reference/agents/getDescription.mdx +1 -1
- package/.docs/raw/reference/agents/getInstructions.mdx +2 -2
- package/.docs/raw/reference/agents/getLLM.mdx +2 -2
- package/.docs/raw/reference/agents/getMemory.mdx +2 -2
- package/.docs/raw/reference/agents/getModel.mdx +2 -2
- package/.docs/raw/reference/agents/getTools.mdx +2 -2
- package/.docs/raw/reference/agents/getVoice.mdx +2 -2
- package/.docs/raw/reference/agents/listAgents.mdx +2 -2
- package/.docs/raw/reference/agents/listScorers.mdx +2 -2
- package/.docs/raw/reference/agents/listTools.mdx +2 -2
- package/.docs/raw/reference/agents/listWorkflows.mdx +2 -2
- package/.docs/raw/reference/agents/network.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/chat-route.mdx +2 -2
- package/.docs/raw/reference/ai-sdk/handle-chat-stream.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/handle-network-stream.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/handle-workflow-stream.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/network-route.mdx +2 -2
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-stream.mdx +6 -6
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v4-messages.mdx +3 -3
- package/.docs/raw/reference/ai-sdk/to-ai-sdk-v5-messages.mdx +3 -3
- package/.docs/raw/reference/ai-sdk/with-mastra.mdx +1 -1
- package/.docs/raw/reference/ai-sdk/workflow-route.mdx +2 -2
- package/.docs/raw/reference/auth/auth0.mdx +1 -2
- package/.docs/raw/reference/auth/clerk.mdx +1 -2
- package/.docs/raw/reference/auth/firebase.mdx +2 -4
- package/.docs/raw/reference/auth/jwt.mdx +1 -2
- package/.docs/raw/reference/auth/supabase.mdx +1 -2
- package/.docs/raw/reference/auth/workos.mdx +1 -2
- package/.docs/raw/reference/cli/create-mastra.mdx +10 -10
- package/.docs/raw/reference/cli/mastra.mdx +9 -9
- package/.docs/raw/reference/client-js/agents.mdx +1 -2
- package/.docs/raw/reference/client-js/mastra-client.mdx +1 -1
- package/.docs/raw/reference/core/getAgent.mdx +1 -1
- package/.docs/raw/reference/core/getAgentById.mdx +1 -1
- package/.docs/raw/reference/core/getDeployer.mdx +1 -1
- package/.docs/raw/reference/core/getLogger.mdx +1 -1
- package/.docs/raw/reference/core/getMCPServer.mdx +1 -1
- package/.docs/raw/reference/core/getMCPServerById.mdx +1 -1
- package/.docs/raw/reference/core/getMemory.mdx +2 -2
- package/.docs/raw/reference/core/getServer.mdx +1 -1
- package/.docs/raw/reference/core/getStorage.mdx +2 -2
- package/.docs/raw/reference/core/getStoredAgentById.mdx +3 -3
- package/.docs/raw/reference/core/getTelemetry.mdx +1 -1
- package/.docs/raw/reference/core/getVector.mdx +1 -1
- package/.docs/raw/reference/core/getWorkflow.mdx +1 -1
- package/.docs/raw/reference/core/listAgents.mdx +1 -1
- package/.docs/raw/reference/core/listLogs.mdx +1 -1
- package/.docs/raw/reference/core/listLogsByRunId.mdx +1 -1
- package/.docs/raw/reference/core/listMCPServers.mdx +1 -1
- package/.docs/raw/reference/core/listMemory.mdx +2 -2
- package/.docs/raw/reference/core/listStoredAgents.mdx +4 -4
- package/.docs/raw/reference/core/listVectors.mdx +1 -1
- package/.docs/raw/reference/core/listWorkflows.mdx +1 -1
- package/.docs/raw/reference/core/setLogger.mdx +1 -1
- package/.docs/raw/reference/core/setStorage.mdx +2 -2
- package/.docs/raw/reference/core/setTelemetry.mdx +1 -1
- package/.docs/raw/reference/deployer/cloudflare.mdx +1 -2
- package/.docs/raw/reference/deployer/deployer.mdx +0 -1
- package/.docs/raw/reference/deployer/netlify.mdx +1 -1
- package/.docs/raw/reference/deployer/vercel.mdx +2 -4
- package/.docs/raw/reference/evals/answer-relevancy.mdx +1 -1
- package/.docs/raw/reference/evals/answer-similarity.mdx +1 -1
- package/.docs/raw/reference/evals/bias.mdx +1 -1
- package/.docs/raw/reference/evals/completeness.mdx +1 -1
- package/.docs/raw/reference/evals/content-similarity.mdx +1 -1
- package/.docs/raw/reference/evals/context-precision.mdx +1 -1
- package/.docs/raw/reference/evals/faithfulness.mdx +1 -1
- package/.docs/raw/reference/evals/hallucination.mdx +1 -1
- package/.docs/raw/reference/evals/keyword-coverage.mdx +1 -1
- package/.docs/raw/reference/evals/prompt-alignment.mdx +7 -7
- package/.docs/raw/reference/evals/textual-difference.mdx +1 -1
- package/.docs/raw/reference/evals/tone-consistency.mdx +1 -1
- package/.docs/raw/reference/evals/tool-call-accuracy.mdx +10 -10
- package/.docs/raw/reference/evals/toxicity.mdx +1 -1
- package/.docs/raw/reference/logging/pino-logger.mdx +7 -8
- package/.docs/raw/reference/memory/createThread.mdx +2 -2
- package/.docs/raw/reference/memory/deleteMessages.mdx +2 -2
- package/.docs/raw/reference/memory/listThreadsByResourceId.mdx +2 -2
- package/.docs/raw/reference/memory/memory-class.mdx +3 -3
- package/.docs/raw/reference/memory/query.mdx +2 -2
- package/.docs/raw/reference/memory/recall.mdx +2 -2
- package/.docs/raw/reference/observability/tracing/exporters/langfuse.mdx +1 -1
- package/.docs/raw/reference/processors/batch-parts-processor.mdx +2 -2
- package/.docs/raw/reference/processors/language-detector.mdx +2 -2
- package/.docs/raw/reference/processors/message-history-processor.mdx +2 -2
- package/.docs/raw/reference/processors/moderation-processor.mdx +3 -3
- package/.docs/raw/reference/processors/pii-detector.mdx +3 -3
- package/.docs/raw/reference/processors/processor-interface.mdx +13 -13
- package/.docs/raw/reference/processors/prompt-injection-detector.mdx +2 -2
- package/.docs/raw/reference/processors/semantic-recall-processor.mdx +2 -2
- package/.docs/raw/reference/processors/system-prompt-scrubber.mdx +2 -2
- package/.docs/raw/reference/processors/token-limiter-processor.mdx +40 -19
- package/.docs/raw/reference/processors/tool-call-filter.mdx +3 -3
- package/.docs/raw/reference/processors/unicode-normalizer.mdx +2 -2
- package/.docs/raw/reference/processors/working-memory-processor.mdx +3 -3
- package/.docs/raw/reference/rag/chunk.mdx +1 -1
- package/.docs/raw/reference/rag/extract-params.mdx +2 -2
- package/.docs/raw/reference/rag/metadata-filters.mdx +7 -7
- package/.docs/raw/reference/server/create-route.mdx +13 -13
- package/.docs/raw/reference/server/express-adapter.mdx +6 -7
- package/.docs/raw/reference/server/hono-adapter.mdx +6 -7
- package/.docs/raw/reference/server/mastra-server.mdx +20 -20
- package/.docs/raw/reference/storage/cloudflare-d1.mdx +7 -5
- package/.docs/raw/reference/storage/cloudflare.mdx +2 -2
- package/.docs/raw/reference/storage/convex.mdx +6 -6
- package/.docs/raw/reference/storage/dynamodb.mdx +4 -4
- package/.docs/raw/reference/storage/lance.mdx +6 -5
- package/.docs/raw/reference/storage/libsql.mdx +72 -54
- package/.docs/raw/reference/storage/mongodb.mdx +84 -9
- package/.docs/raw/reference/storage/mssql.mdx +8 -6
- package/.docs/raw/{memory → reference}/storage/overview.mdx +12 -110
- package/.docs/raw/reference/storage/postgresql.mdx +82 -9
- package/.docs/raw/reference/storage/upstash.mdx +74 -2
- package/.docs/raw/reference/streaming/agents/stream.mdx +5 -5
- package/.docs/raw/reference/streaming/agents/streamLegacy.mdx +2 -2
- package/.docs/raw/reference/streaming/workflows/observeStream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/resumeStream.mdx +1 -1
- package/.docs/raw/reference/streaming/workflows/stream.mdx +2 -2
- package/.docs/raw/reference/streaming/workflows/timeTravelStream.mdx +4 -4
- package/.docs/raw/reference/templates/overview.mdx +1 -2
- package/.docs/raw/reference/tools/create-tool.mdx +1 -4
- package/.docs/raw/reference/tools/vector-query-tool.mdx +1 -1
- package/.docs/raw/reference/vectors/astra.mdx +3 -3
- package/.docs/raw/reference/vectors/chroma.mdx +3 -3
- package/.docs/raw/reference/vectors/convex.mdx +12 -12
- package/.docs/raw/reference/vectors/couchbase.mdx +5 -5
- package/.docs/raw/reference/vectors/duckdb.mdx +10 -10
- package/.docs/raw/reference/vectors/elasticsearch.mdx +4 -4
- package/.docs/raw/reference/vectors/lance.mdx +4 -4
- package/.docs/raw/reference/vectors/libsql.mdx +61 -11
- package/.docs/raw/reference/vectors/mongodb.mdx +58 -5
- package/.docs/raw/reference/vectors/pg.mdx +53 -6
- package/.docs/raw/reference/vectors/pinecone.mdx +3 -3
- package/.docs/raw/reference/vectors/qdrant.mdx +3 -3
- package/.docs/raw/reference/vectors/s3vectors.mdx +6 -6
- package/.docs/raw/reference/vectors/turbopuffer.mdx +4 -4
- package/.docs/raw/reference/vectors/upstash.mdx +55 -6
- package/.docs/raw/reference/vectors/vectorize.mdx +3 -3
- package/.docs/raw/reference/workflows/run-methods/cancel.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/restart.mdx +1 -3
- package/.docs/raw/reference/workflows/run-methods/resume.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/start.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/startAsync.mdx +2 -2
- package/.docs/raw/reference/workflows/run-methods/timeTravel.mdx +5 -5
- package/.docs/raw/reference/workflows/run.mdx +1 -1
- package/.docs/raw/reference/workflows/step.mdx +3 -3
- package/.docs/raw/reference/workflows/workflow-methods/branch.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/commit.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/create-run.mdx +3 -3
- package/.docs/raw/reference/workflows/workflow-methods/dountil.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/dowhile.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/foreach.mdx +6 -6
- package/.docs/raw/reference/workflows/workflow-methods/map.mdx +7 -7
- package/.docs/raw/reference/workflows/workflow-methods/parallel.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/sendEvent.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleep.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/sleepUntil.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow-methods/then.mdx +1 -1
- package/.docs/raw/reference/workflows/workflow-methods/waitForEvent.mdx +2 -2
- package/.docs/raw/reference/workflows/workflow.mdx +3 -3
- package/.docs/raw/server/auth/auth0.mdx +20 -14
- package/.docs/raw/server/auth/clerk.mdx +16 -9
- package/.docs/raw/server/auth/firebase.mdx +21 -15
- package/.docs/raw/server/auth/jwt.mdx +14 -7
- package/.docs/raw/server/auth/supabase.mdx +16 -9
- package/.docs/raw/server/auth/workos.mdx +19 -13
- package/.docs/raw/server/custom-adapters.mdx +10 -10
- package/.docs/raw/server/custom-api-routes.mdx +2 -4
- package/.docs/raw/server/mastra-client.mdx +24 -13
- package/.docs/raw/server/mastra-server.mdx +3 -3
- package/.docs/raw/server/middleware.mdx +7 -7
- package/.docs/raw/server/request-context.mdx +31 -30
- package/.docs/raw/server/server-adapters.mdx +6 -6
- package/.docs/raw/streaming/events.mdx +14 -7
- package/.docs/raw/streaming/overview.mdx +21 -10
- package/.docs/raw/streaming/tool-streaming.mdx +6 -6
- package/.docs/raw/streaming/workflow-streaming.mdx +6 -8
- package/.docs/raw/tools-mcp/advanced-usage.mdx +2 -2
- package/.docs/raw/tools-mcp/mcp-overview.mdx +31 -12
- package/.docs/raw/tools-mcp/overview.mdx +9 -10
- package/.docs/raw/voice/overview.mdx +2 -2
- package/.docs/raw/workflows/agents-and-tools.mdx +28 -19
- package/.docs/raw/workflows/control-flow.mdx +27 -40
- package/.docs/raw/workflows/error-handling.mdx +15 -22
- package/.docs/raw/workflows/human-in-the-loop.mdx +6 -7
- package/.docs/raw/workflows/input-data-mapping.mdx +7 -7
- package/.docs/raw/workflows/overview.mdx +34 -23
- package/.docs/raw/workflows/snapshots.mdx +16 -45
- package/.docs/raw/workflows/suspend-and-resume.mdx +7 -7
- package/.docs/raw/workflows/time-travel.mdx +16 -16
- package/.docs/raw/workflows/workflow-state.mdx +5 -8
- package/CHANGELOG.md +16 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.d.ts.map +1 -1
- package/dist/stdio.js +53 -0
- package/package.json +3 -3
- package/.docs/raw/mastra-cloud/dashboard.mdx +0 -96
- package/.docs/raw/mastra-cloud/setting-up.mdx +0 -102
- package/.docs/raw/memory/conversation-history.mdx +0 -24
- package/.docs/raw/memory/storage/memory-with-libsql.mdx +0 -140
- package/.docs/raw/memory/storage/memory-with-mongodb.mdx +0 -150
- package/.docs/raw/memory/storage/memory-with-pg.mdx +0 -138
- package/.docs/raw/memory/storage/memory-with-upstash.mdx +0 -146
- package/.docs/raw/memory/threads-and-resources.mdx +0 -95
- package/.docs/raw/workflows/inngest-workflow.mdx +0 -363
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Setup | Mastra Cloud"
|
|
3
|
+
description: Import your Mastra project to Mastra Cloud
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import Steps from "@site/src/components/Steps";
|
|
7
|
+
import StepItem from "@site/src/components/StepItem";
|
|
8
|
+
|
|
9
|
+
# Setup
|
|
10
|
+
|
|
11
|
+
Import your Mastra project to [Mastra Cloud](https://cloud.mastra.ai) to use [Studio](/docs/v1/mastra-cloud/studio) and optionally [deploy](/docs/v1/mastra-cloud/deployment) your agent.
|
|
12
|
+
|
|
13
|
+
## Before you begin
|
|
14
|
+
|
|
15
|
+
- [Sign in](https://cloud.mastra.ai) to Cloud
|
|
16
|
+
- Push your [Mastra project](/docs/v1/getting-started/start) to GitHub
|
|
17
|
+
|
|
18
|
+
## Options
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
When you create a new project, you can choose from three options:
|
|
24
|
+
|
|
25
|
+
1. **Create from GitHub** - Import a Mastra project from GitHub
|
|
26
|
+
2. **Create from your server** - Connect a self-hosted Mastra instance to [Studio](/docs/v1/mastra-cloud/studio)
|
|
27
|
+
3. **Create from template** - Start from a [pre-built template](https://mastra.ai/templates)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
To create a project from GitHub, follow these steps:
|
|
31
|
+
|
|
32
|
+
## Create from GitHub
|
|
33
|
+
|
|
34
|
+
<Steps>
|
|
35
|
+
|
|
36
|
+
<StepItem>
|
|
37
|
+
Connect to GitHub when prompted
|
|
38
|
+
|
|
39
|
+

|
|
40
|
+
</StepItem>
|
|
41
|
+
|
|
42
|
+
<StepItem>
|
|
43
|
+
Search for your repository and click **Import**
|
|
44
|
+
|
|
45
|
+

|
|
46
|
+
</StepItem>
|
|
47
|
+
|
|
48
|
+
<StepItem>
|
|
49
|
+
Configure your project settings. Mastra Cloud auto-detects most settings, but you'll still need to enter the environment variables for your configured [model provider](/models/v1):
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
</StepItem>
|
|
53
|
+
|
|
54
|
+
<StepItem>
|
|
55
|
+
|
|
56
|
+
Click **Create Project**
|
|
57
|
+
</StepItem>
|
|
58
|
+
</Steps>
|
|
59
|
+
|
|
60
|
+
## Next steps
|
|
61
|
+
|
|
62
|
+
Once your project is imported, [Studio](/docs/v1/mastra-cloud/studio) automatically creates a sandbox where you can interact with your agents and share access with your team.
|
|
63
|
+
|
|
64
|
+
When you're ready for production, enable [Deployment](/docs/v1/mastra-cloud/deployment) settings and hit deploy!
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Studio | Mastra Cloud"
|
|
3
|
+
description: Run Studio in the cloud for team collaboration
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
import YouTube from "@site/src/components/YouTube-player";
|
|
7
|
+
|
|
8
|
+
# Studio
|
|
9
|
+
|
|
10
|
+
<YouTube id="ojGu6Bi4wYk" />
|
|
11
|
+
|
|
12
|
+
Mastra Cloud provides a hosted version of [Studio](/docs/v1/getting-started/studio) that gives your team a shared environment for interacting with and testing your agents. Team members can chat with agents, review traces, give feedback, and tweak system prompts - without needing to run the project locally.
|
|
13
|
+
|
|
14
|
+
[Set up your project](/docs/v1/mastra-cloud/setup) to access Studio in the cloud.
|
|
15
|
+
|
|
16
|
+
See the [Studio documentation](/docs/v1/getting-started/studio) for details on features like the Agents playground, Workflows runner, Tools testing, and MCP Servers.
|
|
17
|
+
|
|
18
|
+
:::note
|
|
19
|
+
You don't need to deploy your agent to use Studio. Studio runs in a sandbox environment separate from your production deployment
|
|
20
|
+
:::
|
|
21
|
+
|
|
22
|
+
## Sharing access
|
|
23
|
+
|
|
24
|
+
To invite team members, go to [Mastra Cloud](https://cloud.mastra.ai), click **Team Settings**, then **Members** to add them. Once invited, they can sign in and access your project's Studio.
|
|
25
|
+
|
|
26
|
+

|
|
27
|
+
|
|
28
|
+
:::warning
|
|
29
|
+
Team members can view environment variables and delete projects. Only invite people you trust.
|
|
30
|
+
:::
|
|
31
|
+
|
|
32
|
+
## Next steps
|
|
33
|
+
|
|
34
|
+
- [Deployment](/docs/v1/mastra-cloud/deployment) - Manage deployments and settings
|
|
35
|
+
- [Observability](/docs/v1/mastra-cloud/observability) - Monitor traces and logs
|
|
@@ -29,7 +29,7 @@ npm install @mastra/mcp@beta
|
|
|
29
29
|
|
|
30
30
|
The `MCPClient` connects Mastra primitives to external MCP servers, which can be local packages (invoked using `npx`) or remote HTTP(S) endpoints. Each server must be configured with either a `command` or a `url`, depending on how it's hosted.
|
|
31
31
|
|
|
32
|
-
```typescript title="src/mastra/mcp/test-mcp-client.ts"
|
|
32
|
+
```typescript title="src/mastra/mcp/test-mcp-client.ts"
|
|
33
33
|
import { MCPClient } from "@mastra/mcp";
|
|
34
34
|
|
|
35
35
|
export const testMcpClient = new MCPClient({
|
|
@@ -48,13 +48,17 @@ export const testMcpClient = new MCPClient({
|
|
|
48
48
|
});
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
:::info
|
|
52
|
+
|
|
53
|
+
Visit [MCPClient](/reference/v1/tools/mcp-client) for a full list of configuration options.
|
|
54
|
+
|
|
55
|
+
:::
|
|
52
56
|
|
|
53
57
|
## Using `MCPClient` with an agent
|
|
54
58
|
|
|
55
59
|
To use tools from an MCP server in an agent, import your `MCPClient` and call `.getTools()` in the `tools` parameter. This loads from the defined MCP servers, making them available to the agent.
|
|
56
60
|
|
|
57
|
-
```typescript {3,15} title="src/mastra/agents/test-agent.ts"
|
|
61
|
+
```typescript {3,15} title="src/mastra/agents/test-agent.ts"
|
|
58
62
|
import { Agent } from "@mastra/core/agent";
|
|
59
63
|
|
|
60
64
|
import { testMcpClient } from "../mcp/test-mcp-client";
|
|
@@ -73,13 +77,17 @@ export const testAgent = new Agent({
|
|
|
73
77
|
});
|
|
74
78
|
```
|
|
75
79
|
|
|
76
|
-
|
|
80
|
+
:::info
|
|
81
|
+
|
|
82
|
+
Visit [Agent Class](/reference/v1/agents/agent) for a full list of configuration options.
|
|
83
|
+
|
|
84
|
+
:::
|
|
77
85
|
|
|
78
86
|
## Configuring `MCPServer`
|
|
79
87
|
|
|
80
88
|
To expose agents, tools, and workflows from your Mastra application to external systems over HTTP(S) use the `MCPServer` class. This makes them accessible to any system or agent that supports the protocol.
|
|
81
89
|
|
|
82
|
-
```typescript title="src/mastra/mcp/test-mcp-server.ts"
|
|
90
|
+
```typescript title="src/mastra/mcp/test-mcp-server.ts"
|
|
83
91
|
import { MCPServer } from "@mastra/mcp";
|
|
84
92
|
|
|
85
93
|
import { testAgent } from "../agents/test-agent";
|
|
@@ -96,19 +104,22 @@ export const testMcpServer = new MCPServer({
|
|
|
96
104
|
});
|
|
97
105
|
```
|
|
98
106
|
|
|
99
|
-
|
|
107
|
+
:::info
|
|
108
|
+
|
|
109
|
+
Visit [MCPServer](/reference/v1/tools/mcp-server) for a full list of configuration options.
|
|
110
|
+
|
|
111
|
+
:::
|
|
100
112
|
|
|
101
113
|
## Registering an `MCPServer`
|
|
102
114
|
|
|
103
115
|
To make an MCP server available to other systems or agents that support the protocol, register it in the main `Mastra` instance using `mcpServers`.
|
|
104
116
|
|
|
105
|
-
```typescript title="src/mastra/index.ts"
|
|
117
|
+
```typescript title="src/mastra/index.ts"
|
|
106
118
|
import { Mastra } from "@mastra/core/mastra";
|
|
107
119
|
|
|
108
120
|
import { testMcpServer } from "./mcp/test-mcp-server";
|
|
109
121
|
|
|
110
122
|
export const mastra = new Mastra({
|
|
111
|
-
// ...
|
|
112
123
|
mcpServers: { testMcpServer },
|
|
113
124
|
});
|
|
114
125
|
```
|
|
@@ -128,15 +139,18 @@ export const mastra = new Mastra({
|
|
|
128
139
|
|
|
129
140
|
Use the `.getTools()` method to fetch tools from all configured MCP servers. This is suitable when configuration (such as API keys) is static and consistent across users or requests. Call it once and pass the result to the `tools` property when defining your agent.
|
|
130
141
|
|
|
131
|
-
|
|
142
|
+
:::info
|
|
143
|
+
|
|
144
|
+
Visit [getTools()](/reference/v1/tools/mcp-client#gettools) for more information.
|
|
145
|
+
|
|
146
|
+
:::
|
|
132
147
|
|
|
133
|
-
```typescript {
|
|
148
|
+
```typescript {6} title="src/mastra/agents/test-agent.ts"
|
|
134
149
|
import { Agent } from "@mastra/core/agent";
|
|
135
150
|
|
|
136
151
|
import { testMcpClient } from "../mcp/test-mcp-client";
|
|
137
152
|
|
|
138
153
|
export const testAgent = new Agent({
|
|
139
|
-
// ...
|
|
140
154
|
tools: await testMcpClient.getTools(),
|
|
141
155
|
});
|
|
142
156
|
```
|
|
@@ -145,7 +159,7 @@ export const testAgent = new Agent({
|
|
|
145
159
|
|
|
146
160
|
Use the `.getToolsets()` method when tool configuration may vary by request or user, such as in a multi-tenant system where each user provides their own API key. This method returns toolsets that can be passed to the `toolsets` option in the agent's `.generate()` or `.stream()` calls.
|
|
147
161
|
|
|
148
|
-
```typescript {5-16,21}
|
|
162
|
+
```typescript {5-16,21}
|
|
149
163
|
import { MCPClient } from "@mastra/mcp";
|
|
150
164
|
import { mastra } from "./mastra";
|
|
151
165
|
|
|
@@ -177,7 +191,11 @@ async function handleRequest(userPrompt: string, userApiKey: string) {
|
|
|
177
191
|
}
|
|
178
192
|
```
|
|
179
193
|
|
|
180
|
-
|
|
194
|
+
:::info
|
|
195
|
+
|
|
196
|
+
Visit [getToolsets()](/reference/v1/tools/mcp-client#gettoolsets) for more information.
|
|
197
|
+
|
|
198
|
+
:::
|
|
181
199
|
|
|
182
200
|
## Connecting to an MCP registry
|
|
183
201
|
|
|
@@ -32,7 +32,7 @@ Create a file for your stdio server, for example, `/src/mastra/stdio.ts`.
|
|
|
32
32
|
|
|
33
33
|
Add the following code to the file. Remember to import your actual Mastra tools and name the server appropriately.
|
|
34
34
|
|
|
35
|
-
```typescript title="src/mastra/stdio.ts"
|
|
35
|
+
```typescript title="src/mastra/stdio.ts"
|
|
36
36
|
#!/usr/bin/env node
|
|
37
37
|
import { MCPServer } from "@mastra/mcp";
|
|
38
38
|
import { weatherTool } from "./tools";
|
|
@@ -55,7 +55,7 @@ server.startStdio().catch((error) => {
|
|
|
55
55
|
|
|
56
56
|
Update your `package.json` to include the `bin` entry pointing to your built server file and a script to build the server with both ESM and CJS outputs.
|
|
57
57
|
|
|
58
|
-
```json title="package.json"
|
|
58
|
+
```json title="package.json"
|
|
59
59
|
{
|
|
60
60
|
"bin": "dist/stdio.mjs",
|
|
61
61
|
"scripts": {
|
|
@@ -7,7 +7,7 @@ description: "Learn how to use memory processors in Mastra to filter, trim, and
|
|
|
7
7
|
|
|
8
8
|
Memory processors transform and filter messages as they pass through an agent with memory enabled. They manage context window limits, remove unnecessary content, and optimize the information sent to the language model.
|
|
9
9
|
|
|
10
|
-
When memory is enabled on an agent, Mastra adds memory processors to the agent's processor pipeline. These processors retrieve
|
|
10
|
+
When memory is enabled on an agent, Mastra adds memory processors to the agent's processor pipeline. These processors retrieve message history, working memory, and semantically relevant messages, then persist new messages after the model responds.
|
|
11
11
|
|
|
12
12
|
Memory processors are [processors](/docs/v1/agents/processors) that operate specifically on memory-related messages and state.
|
|
13
13
|
|
|
@@ -17,7 +17,7 @@ Mastra automatically adds these processors when memory is enabled:
|
|
|
17
17
|
|
|
18
18
|
### MessageHistory
|
|
19
19
|
|
|
20
|
-
Retrieves
|
|
20
|
+
Retrieves message history and persists new messages.
|
|
21
21
|
|
|
22
22
|
**When you configure:**
|
|
23
23
|
|
|
@@ -40,7 +40,7 @@ memory: new Memory({
|
|
|
40
40
|
|
|
41
41
|
**Example:**
|
|
42
42
|
|
|
43
|
-
```typescript
|
|
43
|
+
```typescript
|
|
44
44
|
import { Agent } from "@mastra/core/agent";
|
|
45
45
|
import { Memory } from "@mastra/memory";
|
|
46
46
|
import { LibSQLStore } from "@mastra/libsql";
|
|
@@ -89,7 +89,7 @@ memory: new Memory({
|
|
|
89
89
|
|
|
90
90
|
**Example:**
|
|
91
91
|
|
|
92
|
-
```typescript
|
|
92
|
+
```typescript
|
|
93
93
|
import { Agent } from "@mastra/core/agent";
|
|
94
94
|
import { Memory } from "@mastra/memory";
|
|
95
95
|
import { LibSQLStore } from "@mastra/libsql";
|
|
@@ -145,7 +145,7 @@ memory: new Memory({
|
|
|
145
145
|
|
|
146
146
|
**Example:**
|
|
147
147
|
|
|
148
|
-
```typescript
|
|
148
|
+
```typescript
|
|
149
149
|
import { Agent } from "@mastra/core/agent";
|
|
150
150
|
import { Memory } from "@mastra/memory";
|
|
151
151
|
import { LibSQLStore } from "@mastra/libsql";
|
|
@@ -169,7 +169,7 @@ const agent = new Agent({
|
|
|
169
169
|
|
|
170
170
|
If you manually add a memory processor to `inputProcessors` or `outputProcessors`, Mastra will **not** automatically add it. This gives you full control over processor ordering:
|
|
171
171
|
|
|
172
|
-
```typescript
|
|
172
|
+
```typescript
|
|
173
173
|
import { Agent } from "@mastra/core/agent";
|
|
174
174
|
import { Memory } from "@mastra/memory";
|
|
175
175
|
import { MessageHistory } from "@mastra/memory/processors";
|
|
@@ -211,7 +211,7 @@ Understanding the execution order is important when combining guardrails with me
|
|
|
211
211
|
1. **Memory processors run FIRST**: `WorkingMemory`, `MessageHistory`, `SemanticRecall`
|
|
212
212
|
2. **Your input processors run AFTER**: guardrails, filters, validators
|
|
213
213
|
|
|
214
|
-
This means memory loads
|
|
214
|
+
This means memory loads message history before your processors can validate or filter the input.
|
|
215
215
|
|
|
216
216
|
### Output Processors
|
|
217
217
|
|
|
@@ -236,7 +236,7 @@ Output guardrails run **before** memory processors save messages. If a guardrail
|
|
|
236
236
|
- Memory processors are skipped
|
|
237
237
|
- **No messages are persisted to storage**
|
|
238
238
|
|
|
239
|
-
```typescript
|
|
239
|
+
```typescript
|
|
240
240
|
import { Agent } from "@mastra/core/agent";
|
|
241
241
|
import { Memory } from "@mastra/memory";
|
|
242
242
|
import { openai } from "@ai-sdk/openai";
|
|
@@ -281,7 +281,7 @@ Input guardrails run **after** memory processors load history. If a guardrail ab
|
|
|
281
281
|
- Output processors (including memory persistence) are skipped
|
|
282
282
|
- **No messages are persisted to storage**
|
|
283
283
|
|
|
284
|
-
```typescript
|
|
284
|
+
```typescript
|
|
285
285
|
// Input guardrail that validates user input
|
|
286
286
|
const inputValidator = {
|
|
287
287
|
id: "input-validator",
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Message History | Memory"
|
|
3
|
+
description: "Learn how to configure message history in Mastra to store recent messages from the current conversation."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Message History
|
|
7
|
+
|
|
8
|
+
Message history is the simplest kind of memory. It is a list of messages from the current conversation.
|
|
9
|
+
|
|
10
|
+
Once enabled, each request includes the last 10 messages from the current memory thread, giving the agent short-term conversational context. This limit can be increased using the `lastMessages` parameter:
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
export const agent = new Agent({
|
|
14
|
+
id: "test-agent",
|
|
15
|
+
memory: new Memory({
|
|
16
|
+
options: {
|
|
17
|
+
lastMessages: 20,
|
|
18
|
+
},
|
|
19
|
+
}),
|
|
20
|
+
});
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Querying Messages
|
|
24
|
+
|
|
25
|
+
Messages are stored in the `MastraDBMessage` format, which provides a consistent structure across the entire Mastra system:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
// Get messages for a thread with pagination
|
|
29
|
+
const result = await mastra
|
|
30
|
+
.getStorage()
|
|
31
|
+
.listMessages({
|
|
32
|
+
threadId: "your-thread-id",
|
|
33
|
+
page: 0,
|
|
34
|
+
perPage: 50
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
console.log(result.messages); // MastraDBMessage[]
|
|
38
|
+
console.log(result.total); // Total count
|
|
39
|
+
console.log(result.hasMore); // Whether more pages exist
|
|
40
|
+
|
|
41
|
+
// Get messages from multiple threads at once
|
|
42
|
+
const multiThreadResult = await mastra
|
|
43
|
+
.getStorage()
|
|
44
|
+
.listMessages({
|
|
45
|
+
threadId: ["thread-1", "thread-2", "thread-3"],
|
|
46
|
+
page: 0,
|
|
47
|
+
perPage: 100
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Get messages by their IDs
|
|
51
|
+
const messages = await mastra
|
|
52
|
+
.getStorage()
|
|
53
|
+
.listMessagesById({ messageIds: messageIdArr });
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The `threadId` parameter accepts either a single thread ID string or an array of thread IDs to query messages from multiple threads in a single request.
|
|
57
|
+
|
|
58
|
+
All message queries return `MastraDBMessage[]` format. If you need to convert messages to AI SDK formats for UI rendering, use the conversion utilities from `@mastra/ai-sdk/ui`:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import { toAISdkV5Messages } from '@mastra/ai-sdk/ui';
|
|
62
|
+
|
|
63
|
+
const result = await mastra
|
|
64
|
+
.getStorage()
|
|
65
|
+
.listMessages({ threadId: "your-thread-id" });
|
|
66
|
+
|
|
67
|
+
// Convert to AI SDK v5 UIMessage format for UI rendering
|
|
68
|
+
const uiMessages = toAISdkV5Messages(result.messages);
|
|
69
|
+
```
|
|
@@ -1,32 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Memory overview | Memory"
|
|
3
|
-
description: "Learn how Mastra's memory system works with working memory,
|
|
3
|
+
description: "Learn how Mastra's memory system works with working memory, message history, and semantic recall."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Memory
|
|
6
|
+
# Memory
|
|
7
7
|
|
|
8
|
-
Memory
|
|
8
|
+
Memory gives your agent coherence across interactions and allows it to improve over time by retaining relevant information from past conversations.
|
|
9
9
|
|
|
10
|
-
Mastra
|
|
10
|
+
Mastra requires a [storage provider](./storage) to persist memory and supports three types:
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
- [**Message history**](/docs/v1/memory/message-history) captures recent messages from the current conversation, providing short-term continuity and maintaining dialogue flow.
|
|
13
|
+
- [**Working memory**](/docs/v1/memory/working-memory) stores persistent user-specific details such as names, preferences, goals, and other structured data.
|
|
14
|
+
- [**Semantic recall**](/docs/v1/memory/semantic-recall) retrieves older messages from past conversations based on semantic relevance. Matches are retrieved using vector search and can include surrounding context for better comprehension.
|
|
15
|
+
|
|
16
|
+
You can enable any combination of these memory types. Mastra assembles the relevant memories into the model’s context window. If the total exceeds the model's token limit, use [memory processors](/docs/v1/memory/memory-processors) to trim or filter messages before sending them to the model.
|
|
13
17
|
|
|
14
18
|
## Getting started
|
|
15
19
|
|
|
16
|
-
|
|
20
|
+
Install Mastra's memory module and the storage adapter for your preferred database (see the storage section below):
|
|
17
21
|
|
|
18
|
-
```bash
|
|
19
|
-
npm install @mastra/
|
|
22
|
+
```bash
|
|
23
|
+
npm install @mastra/memory@beta @mastra/libsql@beta
|
|
20
24
|
```
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
Add the storage adapter to the main Mastra instance:
|
|
23
27
|
|
|
24
|
-
```typescript
|
|
28
|
+
```typescript title="src/mastra/index.ts"
|
|
25
29
|
import { Mastra } from "@mastra/core";
|
|
26
30
|
import { LibSQLStore } from "@mastra/libsql";
|
|
27
31
|
|
|
28
32
|
export const mastra = new Mastra({
|
|
29
|
-
// ...
|
|
30
33
|
storage: new LibSQLStore({
|
|
31
34
|
id: 'mastra-storage',
|
|
32
35
|
url: ":memory:",
|
|
@@ -34,88 +37,43 @@ export const mastra = new Mastra({
|
|
|
34
37
|
});
|
|
35
38
|
```
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
```typescript {3-5} title="src/mastra/agents/test-agent.ts" showLineNumbers copy
|
|
40
|
-
import { Memory } from "@mastra/memory";
|
|
41
|
-
import { Agent } from "@mastra/core/agent";
|
|
42
|
-
|
|
43
|
-
export const testAgent = new Agent({
|
|
44
|
-
id: "test-agent",
|
|
45
|
-
// ...
|
|
46
|
-
memory: new Memory(),
|
|
47
|
-
});
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
That memory instance has options you can configure for working memory, conversation history, and semantic recall.
|
|
51
|
-
|
|
52
|
-
## Different types of memory
|
|
53
|
-
|
|
54
|
-
Mastra supports three types of memory: working memory, conversation history, and semantic recall.
|
|
55
|
-
|
|
56
|
-
[**Working memory**](./working-memory) stores persistent user-specific details such as names, preferences, goals, and other structured data. (Compare this to ChatGPT where you can ask it to tell you about yourself). This is implemented as a block of Markdown text that the agent is able to update over time (or alternately, as a Zod schema)
|
|
57
|
-
|
|
58
|
-
[**Conversation history**](./conversation-history) captures recent messages from the current conversation, providing short-term continuity and maintaining dialogue flow.
|
|
59
|
-
|
|
60
|
-
[**Semantic recall**](./semantic-recall) retrieves older messages from past conversations based on semantic relevance. Matches are retrieved using vector search and can include surrounding context for better comprehension.
|
|
40
|
+
Enable memory by passing a `Memory` instance to your agent:
|
|
61
41
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
## Scoping memory with threads and resources
|
|
65
|
-
|
|
66
|
-
All memory types are [resource-scoped](./working-memory#resource-scoped-memory-default) by default, meaning they persist across all conversations for the same user or entity. [Thread-scoped](./working-memory#thread-scoped-memory) configuration isolates memory to a single conversation thread.
|
|
67
|
-
|
|
68
|
-
## Memory Storage Adapters
|
|
69
|
-
|
|
70
|
-
To persist and recall information between conversations, memory requires a storage adapter.
|
|
71
|
-
|
|
72
|
-
Supported options include [LibSQL](/docs/v1/memory/storage/memory-with-libsql), [MongoDB](/docs/v1/memory/storage/memory-with-mongodb), [Postgres](/docs/v1/memory/storage/memory-with-pg), and [Upstash](/docs/v1/memory/storage/memory-with-upstash)
|
|
73
|
-
|
|
74
|
-
We use LibSQL out of the box because it is file-based or in-memory, so it is easy to install and works well with Studio.
|
|
75
|
-
|
|
76
|
-
## Dedicated storage
|
|
77
|
-
|
|
78
|
-
Agents can be configured with their own dedicated storage, keeping tasks, conversations, and recalled information separate across agents.
|
|
79
|
-
|
|
80
|
-
### Adding storage to agents
|
|
81
|
-
|
|
82
|
-
To assign dedicated storage to an agent, install and import the required dependency and pass a `storage` instance to the `Memory` constructor:
|
|
83
|
-
|
|
84
|
-
```typescript {3, 9-11} title="src/mastra/agents/test-agent.ts" showLineNumbers copy
|
|
42
|
+
```typescript title="src/mastra/agents/test-agent.ts"
|
|
85
43
|
import { Memory } from "@mastra/memory";
|
|
86
44
|
import { Agent } from "@mastra/core/agent";
|
|
87
|
-
import { LibSQLStore } from "@mastra/libsql";
|
|
88
45
|
|
|
89
46
|
export const testAgent = new Agent({
|
|
90
47
|
id: "test-agent",
|
|
91
|
-
// ...
|
|
92
48
|
memory: new Memory({
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
url: "file:agent-memory.db",
|
|
97
|
-
}),
|
|
98
|
-
// ...
|
|
49
|
+
options: {
|
|
50
|
+
lastMessages: 20,
|
|
51
|
+
},
|
|
99
52
|
}),
|
|
100
53
|
});
|
|
101
54
|
```
|
|
55
|
+
When you send a new message, the model can now "see" the previous 20 messages, which gives it better context for the conversation and leads to more coherent, accurate replies.
|
|
102
56
|
|
|
103
|
-
|
|
57
|
+
This example configures basic [message history](/docs/v1/memory/message-history). You can also enable [working memory](/docs/v1/memory/working-memory) and [semantic recall](/docs/v1/memory/semantic-recall) by passing additional options to `Memory`.
|
|
104
58
|
|
|
105
|
-
|
|
59
|
+
## Storage
|
|
106
60
|
|
|
107
|
-
|
|
61
|
+
Before enabling memory, you must first configure a storage adapter. Mastra supports multiple database providers including PostgreSQL, MongoDB, libSQL, and more.
|
|
108
62
|
|
|
109
|
-
|
|
63
|
+
Storage can be configured at the instance level (shared across all agents) or at the agent level (dedicated per agent). You can also use different databases for storage and vector operations.
|
|
110
64
|
|
|
111
|
-
|
|
65
|
+
See the [Storage](/docs/v1/memory/storage) documentation for configuration options, supported providers, and examples.
|
|
112
66
|
|
|
113
|
-
|
|
67
|
+
## Debugging memory
|
|
114
68
|
|
|
115
|
-
|
|
69
|
+
When tracing is enabled, you can inspect exactly which messages the agent uses for context in each request. The trace output shows all memory included in the agent's context window - both recent message history and messages recalled via semantic recall.
|
|
116
70
|
|
|
117
|
-
|
|
71
|
+
This visibility helps you understand why an agent made specific decisions and verify that memory retrieval is working as expected.
|
|
72
|
+
|
|
73
|
+
For more details on enabling and configuring tracing, see [Tracing](/docs/v1/observability/tracing/overview).
|
|
118
74
|
|
|
119
|
-
|
|
75
|
+
## Next Steps
|
|
120
76
|
|
|
121
|
-
|
|
77
|
+
- Learn more about [Storage](/docs/v1/memory/storage) providers and configuration options
|
|
78
|
+
- Add [Message History](/docs/v1/memory/message-history), [Working Memory](/docs/v1/memory/working-memory), or [Semantic Recall](/docs/v1/memory/semantic-recall)
|
|
79
|
+
- Visit [Memory configuration reference](/reference/v1/memory/memory-class) for all available options
|