@mastra/mcp-docs-server 1.0.0-beta.13 → 1.0.0-beta.14
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 +19 -19
- package/.docs/organized/changelogs/%40mastra%2Fai-sdk.md +28 -28
- package/.docs/organized/changelogs/%40mastra%2Fclient-js.md +98 -98
- package/.docs/organized/changelogs/%40mastra%2Fconvex.md +30 -0
- package/.docs/organized/changelogs/%40mastra%2Fcore.md +171 -171
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloud.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fdeployer-cloudflare.md +16 -16
- package/.docs/organized/changelogs/%40mastra%2Fdeployer.md +15 -15
- package/.docs/organized/changelogs/%40mastra%2Fmcp-docs-server.md +10 -10
- package/.docs/organized/changelogs/%40mastra%2Fmemory.md +12 -12
- package/.docs/organized/changelogs/%40mastra%2Fplayground-ui.md +22 -22
- package/.docs/organized/changelogs/%40mastra%2Frag.md +17 -17
- package/.docs/organized/changelogs/%40mastra%2Freact.md +9 -2
- package/.docs/organized/changelogs/%40mastra%2Fserver.md +94 -94
- package/.docs/organized/changelogs/create-mastra.md +3 -3
- package/.docs/organized/changelogs/mastra.md +17 -17
- package/.docs/organized/code-examples/agent-v6.md +151 -0
- package/.docs/organized/code-examples/ai-elements.md +1 -1
- package/.docs/raw/agents/adding-voice.mdx +2 -3
- 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 -0
- package/.docs/raw/deployment/web-framework.mdx +4 -6
- 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/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 +386 -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/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/setting-up.mdx +6 -2
- 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 +6 -7
- 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 +2 -2
- 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 +3 -3
- 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 +3 -3
- package/.docs/raw/reference/storage/libsql.mdx +69 -54
- package/.docs/raw/reference/storage/mongodb.mdx +80 -7
- package/.docs/raw/reference/storage/mssql.mdx +4 -4
- package/.docs/raw/{memory → reference}/storage/overview.mdx +12 -110
- package/.docs/raw/reference/storage/postgresql.mdx +78 -7
- 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 +1 -1
- 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/inngest-workflow.mdx +8 -9
- package/.docs/raw/workflows/input-data-mapping.mdx +7 -7
- package/.docs/raw/workflows/overview.mdx +33 -22
- package/.docs/raw/workflows/snapshots.mdx +14 -44
- 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 +9 -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 +4 -4
- 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
|
@@ -15,7 +15,7 @@ Use [`handleChatStream()`](/reference/v1/ai-sdk/handle-chat-stream) if you need
|
|
|
15
15
|
|
|
16
16
|
This example shows how to set up a chat route at the `/chat` endpoint that uses an agent with the ID `weatherAgent`.
|
|
17
17
|
|
|
18
|
-
```typescript title="src/mastra/index.ts"
|
|
18
|
+
```typescript title="src/mastra/index.ts"
|
|
19
19
|
import { Mastra } from "@mastra/core";
|
|
20
20
|
import { chatRoute } from "@mastra/ai-sdk";
|
|
21
21
|
|
|
@@ -33,7 +33,7 @@ export const mastra = new Mastra({
|
|
|
33
33
|
|
|
34
34
|
You can also use dynamic agent routing based on an `agentId`. The URL `/chat/weatherAgent` will resolve to the agent with the ID `weatherAgent`.
|
|
35
35
|
|
|
36
|
-
```typescript title="src/mastra/index.ts"
|
|
36
|
+
```typescript title="src/mastra/index.ts"
|
|
37
37
|
import { Mastra } from "@mastra/core";
|
|
38
38
|
import { chatRoute } from "@mastra/ai-sdk";
|
|
39
39
|
|
|
@@ -17,7 +17,7 @@ Use [`chatRoute()`](/reference/v1/ai-sdk/chat-route) if you want to create a cha
|
|
|
17
17
|
|
|
18
18
|
Next.js App Router example:
|
|
19
19
|
|
|
20
|
-
```typescript title="app/api/chat/route.ts"
|
|
20
|
+
```typescript title="app/api/chat/route.ts"
|
|
21
21
|
import { handleChatStream } from '@mastra/ai-sdk';
|
|
22
22
|
import { createUIMessageStreamResponse } from 'ai';
|
|
23
23
|
import { mastra } from '@/src/mastra';
|
|
@@ -16,7 +16,7 @@ Use [`networkRoute()`](/reference/v1/ai-sdk/network-route) if you want to create
|
|
|
16
16
|
|
|
17
17
|
Next.js App Router example:
|
|
18
18
|
|
|
19
|
-
```typescript title="app/api/network/route.ts"
|
|
19
|
+
```typescript title="app/api/network/route.ts"
|
|
20
20
|
import { handleNetworkStream } from '@mastra/ai-sdk';
|
|
21
21
|
import { createUIMessageStreamResponse } from 'ai';
|
|
22
22
|
import { mastra } from '@/src/mastra';
|
|
@@ -25,7 +25,7 @@ See [Workflow Streaming](/docs/v1/streaming/workflow-streaming#streaming-agent-t
|
|
|
25
25
|
|
|
26
26
|
Next.js App Router example:
|
|
27
27
|
|
|
28
|
-
```typescript title="app/api/workflow/route.ts"
|
|
28
|
+
```typescript title="app/api/workflow/route.ts"
|
|
29
29
|
import { handleWorkflowStream } from '@mastra/ai-sdk';
|
|
30
30
|
import { createUIMessageStreamResponse } from 'ai';
|
|
31
31
|
import { mastra } from '@/src/mastra';
|
|
@@ -15,7 +15,7 @@ Use [`handleNetworkStream()`](/reference/v1/ai-sdk/handle-network-stream) if you
|
|
|
15
15
|
|
|
16
16
|
This example shows how to set up a network route at the `/network` endpoint that uses an agent with the ID `weatherAgent`.
|
|
17
17
|
|
|
18
|
-
```typescript title="src/mastra/index.ts"
|
|
18
|
+
```typescript title="src/mastra/index.ts"
|
|
19
19
|
import { Mastra } from "@mastra/core";
|
|
20
20
|
import { networkRoute } from "@mastra/ai-sdk";
|
|
21
21
|
|
|
@@ -33,7 +33,7 @@ export const mastra = new Mastra({
|
|
|
33
33
|
|
|
34
34
|
You can also use dynamic agent routing based on an `agentId`. The URL `/network/weatherAgent` will resolve to the agent with the ID `weatherAgent`.
|
|
35
35
|
|
|
36
|
-
```typescript title="src/mastra/index.ts"
|
|
36
|
+
```typescript title="src/mastra/index.ts"
|
|
37
37
|
import { Mastra } from "@mastra/core";
|
|
38
38
|
import { networkRoute } from "@mastra/ai-sdk";
|
|
39
39
|
|
|
@@ -15,7 +15,7 @@ This is useful when building custom streaming endpoints outside Mastra's provide
|
|
|
15
15
|
|
|
16
16
|
Next.js App Router example:
|
|
17
17
|
|
|
18
|
-
```typescript title="app/api/chat/route.ts"
|
|
18
|
+
```typescript title="app/api/chat/route.ts"
|
|
19
19
|
import { mastra } from "../../mastra";
|
|
20
20
|
import { createUIMessageStream, createUIMessageStreamResponse } from "ai";
|
|
21
21
|
import { toAISdkStream } from "@mastra/ai-sdk";
|
|
@@ -124,7 +124,7 @@ The second parameter is an options object:
|
|
|
124
124
|
|
|
125
125
|
### Converting a workflow stream
|
|
126
126
|
|
|
127
|
-
```typescript title="app/api/workflow/route.ts"
|
|
127
|
+
```typescript title="app/api/workflow/route.ts" {13}
|
|
128
128
|
import { mastra } from "../../mastra";
|
|
129
129
|
import { createUIMessageStream, createUIMessageStreamResponse } from "ai";
|
|
130
130
|
import { toAISdkStream } from "@mastra/ai-sdk";
|
|
@@ -151,7 +151,7 @@ export async function POST(req: Request) {
|
|
|
151
151
|
|
|
152
152
|
### Converting a network stream
|
|
153
153
|
|
|
154
|
-
```typescript title="app/api/network/route.ts"
|
|
154
|
+
```typescript title="app/api/network/route.ts" {12}
|
|
155
155
|
import { mastra } from "../../mastra";
|
|
156
156
|
import { createUIMessageStream, createUIMessageStreamResponse } from "ai";
|
|
157
157
|
import { toAISdkStream } from "@mastra/ai-sdk";
|
|
@@ -177,7 +177,7 @@ export async function POST(req: Request) {
|
|
|
177
177
|
|
|
178
178
|
### Converting an agent stream with reasoning enabled
|
|
179
179
|
|
|
180
|
-
```typescript title="app/api/reasoning/route.ts"
|
|
180
|
+
```typescript title="app/api/reasoning/route.ts" {8-12,17-20}
|
|
181
181
|
import { mastra } from "../../mastra";
|
|
182
182
|
import { createUIMessageStream, createUIMessageStreamResponse } from "ai";
|
|
183
183
|
import { toAISdkStream } from "@mastra/ai-sdk";
|
|
@@ -211,7 +211,7 @@ export async function POST(req: Request) {
|
|
|
211
211
|
|
|
212
212
|
### Using messageMetadata
|
|
213
213
|
|
|
214
|
-
```typescript title="app/api/chat-with-metadata/route.ts"
|
|
214
|
+
```typescript title="app/api/chat-with-metadata/route.ts" {13-19}
|
|
215
215
|
import { mastra } from "../../mastra";
|
|
216
216
|
import { createUIMessageStream, createUIMessageStreamResponse } from "ai";
|
|
217
217
|
import { toAISdkStream } from "@mastra/ai-sdk";
|
|
@@ -246,7 +246,7 @@ export async function POST(req: Request) {
|
|
|
246
246
|
|
|
247
247
|
If you're using the Mastra client SDK (`@mastra/client-js`) on the client side and want to convert streams to AI SDK format:
|
|
248
248
|
|
|
249
|
-
```typescript title="client-stream-to-ai-sdk.ts"
|
|
249
|
+
```typescript title="client-stream-to-ai-sdk.ts" {14-23,25-35}
|
|
250
250
|
import { MastraClient } from "@mastra/client-js";
|
|
251
251
|
import { createUIMessageStream } from "ai";
|
|
252
252
|
import { toAISdkStream } from "@mastra/ai-sdk";
|
|
@@ -11,7 +11,7 @@ Converts messages from various input formats to AI SDK V4 UI message format. Thi
|
|
|
11
11
|
|
|
12
12
|
## Usage example
|
|
13
13
|
|
|
14
|
-
```typescript title="app/chat/page.tsx"
|
|
14
|
+
```typescript title="app/chat/page.tsx"
|
|
15
15
|
import { toAISdkV4Messages } from "@mastra/ai-sdk";
|
|
16
16
|
import { useChat } from "ai/react"; // AI SDK V4
|
|
17
17
|
|
|
@@ -107,7 +107,7 @@ Returns an array of AI SDK V4 `UIMessage` objects with the following structure:
|
|
|
107
107
|
|
|
108
108
|
### Converting simple text messages
|
|
109
109
|
|
|
110
|
-
```typescript
|
|
110
|
+
```typescript
|
|
111
111
|
import { toAISdkV4Messages } from "@mastra/ai-sdk";
|
|
112
112
|
|
|
113
113
|
const messages = toAISdkV4Messages(["Hello", "How can I help you today?"]);
|
|
@@ -116,7 +116,7 @@ const messages = toAISdkV4Messages(["Hello", "How can I help you today?"]);
|
|
|
116
116
|
|
|
117
117
|
### Loading messages with Mastra client
|
|
118
118
|
|
|
119
|
-
```typescript
|
|
119
|
+
```typescript
|
|
120
120
|
import { MastraClient } from "@mastra/client-js";
|
|
121
121
|
import { toAISdkV4Messages } from "@mastra/ai-sdk";
|
|
122
122
|
|
|
@@ -11,7 +11,7 @@ Converts messages from various input formats to AI SDK V5 UI message format. Thi
|
|
|
11
11
|
|
|
12
12
|
## Usage example
|
|
13
13
|
|
|
14
|
-
```typescript title="app/chat/page.tsx"
|
|
14
|
+
```typescript title="app/chat/page.tsx"
|
|
15
15
|
import { toAISdkV5Messages } from "@mastra/ai-sdk";
|
|
16
16
|
import { useChat } from "ai/react";
|
|
17
17
|
|
|
@@ -87,7 +87,7 @@ Returns an array of AI SDK V5 `UIMessage` objects with the following structure:
|
|
|
87
87
|
|
|
88
88
|
### Converting simple text messages
|
|
89
89
|
|
|
90
|
-
```typescript
|
|
90
|
+
```typescript
|
|
91
91
|
import { toAISdkV5Messages } from "@mastra/ai-sdk";
|
|
92
92
|
|
|
93
93
|
const messages = toAISdkV5Messages(["Hello", "How can I help you today?"]);
|
|
@@ -96,7 +96,7 @@ const messages = toAISdkV5Messages(["Hello", "How can I help you today?"]);
|
|
|
96
96
|
|
|
97
97
|
### Loading messages with Mastra client
|
|
98
98
|
|
|
99
|
-
```typescript
|
|
99
|
+
```typescript
|
|
100
100
|
import { MastraClient } from "@mastra/client-js";
|
|
101
101
|
import { toAISdkV5Messages } from "@mastra/ai-sdk";
|
|
102
102
|
|
|
@@ -11,7 +11,7 @@ Wraps an AI SDK model with Mastra processors and/or memory.
|
|
|
11
11
|
|
|
12
12
|
## Usage example
|
|
13
13
|
|
|
14
|
-
```typescript title="src/example.ts"
|
|
14
|
+
```typescript title="src/example.ts"
|
|
15
15
|
import { openai } from '@ai-sdk/openai';
|
|
16
16
|
import { generateText } from 'ai';
|
|
17
17
|
import { withMastra } from '@mastra/ai-sdk';
|
|
@@ -23,7 +23,7 @@ See [Workflow Streaming](/docs/v1/streaming/workflow-streaming#streaming-agent-t
|
|
|
23
23
|
|
|
24
24
|
This example shows how to set up a workflow route at the `/workflow` endpoint that uses a workflow with the ID `weatherWorkflow`.
|
|
25
25
|
|
|
26
|
-
```typescript title="src/mastra/index.ts"
|
|
26
|
+
```typescript title="src/mastra/index.ts"
|
|
27
27
|
import { Mastra } from "@mastra/core";
|
|
28
28
|
import { workflowRoute } from "@mastra/ai-sdk";
|
|
29
29
|
|
|
@@ -41,7 +41,7 @@ export const mastra = new Mastra({
|
|
|
41
41
|
|
|
42
42
|
You can also use dynamic workflow routing based on a `workflowId`. The URL `/workflow/weatherWorkflow` will resolve to the workflow with the ID `weatherWorkflow`.
|
|
43
43
|
|
|
44
|
-
```typescript title="src/mastra/index.ts"
|
|
44
|
+
```typescript title="src/mastra/index.ts"
|
|
45
45
|
import { Mastra } from "@mastra/core";
|
|
46
46
|
import { workflowRoute } from "@mastra/ai-sdk";
|
|
47
47
|
|
|
@@ -9,12 +9,11 @@ The `MastraAuthAuth0` class provides authentication for Mastra using Auth0. It v
|
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript title="src/mastra/index.ts"
|
|
12
|
+
```typescript title="src/mastra/index.ts"
|
|
13
13
|
import { Mastra } from "@mastra/core";
|
|
14
14
|
import { MastraAuthAuth0 } from "@mastra/auth-auth0";
|
|
15
15
|
|
|
16
16
|
export const mastra = new Mastra({
|
|
17
|
-
// ..
|
|
18
17
|
server: {
|
|
19
18
|
auth: new MastraAuthAuth0({
|
|
20
19
|
domain: process.env.AUTH0_DOMAIN,
|
|
@@ -9,12 +9,11 @@ The `MastraAuthClerk` class provides authentication for Mastra applications usin
|
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript title="src/mastra/index.ts"
|
|
12
|
+
```typescript title="src/mastra/index.ts"
|
|
13
13
|
import { Mastra } from "@mastra/core";
|
|
14
14
|
import { MastraAuthClerk } from "@mastra/auth-clerk";
|
|
15
15
|
|
|
16
16
|
export const mastra = new Mastra({
|
|
17
|
-
// ..
|
|
18
17
|
server: {
|
|
19
18
|
auth: new MastraAuthClerk({
|
|
20
19
|
jwksUri: process.env.CLERK_JWKS_URI,
|
|
@@ -11,13 +11,12 @@ The `MastraAuthFirebase` class provides authentication for Mastra using Firebase
|
|
|
11
11
|
|
|
12
12
|
### Basic usage with environment variables
|
|
13
13
|
|
|
14
|
-
```typescript title="src/mastra/index.ts"
|
|
14
|
+
```typescript title="src/mastra/index.ts"
|
|
15
15
|
import { Mastra } from "@mastra/core";
|
|
16
16
|
import { MastraAuthFirebase } from "@mastra/auth-firebase";
|
|
17
17
|
|
|
18
18
|
// Automatically uses FIREBASE_SERVICE_ACCOUNT and FIRESTORE_DATABASE_ID env vars
|
|
19
19
|
export const mastra = new Mastra({
|
|
20
|
-
// ..
|
|
21
20
|
server: {
|
|
22
21
|
auth: new MastraAuthFirebase(),
|
|
23
22
|
},
|
|
@@ -26,12 +25,11 @@ export const mastra = new Mastra({
|
|
|
26
25
|
|
|
27
26
|
### Custom configuration
|
|
28
27
|
|
|
29
|
-
```typescript title="src/mastra/index.ts"
|
|
28
|
+
```typescript title="src/mastra/index.ts"
|
|
30
29
|
import { Mastra } from "@mastra/core";
|
|
31
30
|
import { MastraAuthFirebase } from "@mastra/auth-firebase";
|
|
32
31
|
|
|
33
32
|
export const mastra = new Mastra({
|
|
34
|
-
// ..
|
|
35
33
|
server: {
|
|
36
34
|
auth: new MastraAuthFirebase({
|
|
37
35
|
serviceAccount: "/path/to/service-account-key.json",
|
|
@@ -9,12 +9,11 @@ The `MastraJwtAuth` class provides a lightweight authentication mechanism for Ma
|
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript title="src/mastra/index.ts"
|
|
12
|
+
```typescript title="src/mastra/index.ts"
|
|
13
13
|
import { Mastra } from "@mastra/core";
|
|
14
14
|
import { MastraJwtAuth } from "@mastra/auth";
|
|
15
15
|
|
|
16
16
|
export const mastra = new Mastra({
|
|
17
|
-
// ..
|
|
18
17
|
server: {
|
|
19
18
|
auth: new MastraJwtAuth({
|
|
20
19
|
secret: "<your-secret>",
|
|
@@ -9,12 +9,11 @@ The `MastraAuthSupabase` class provides authentication for Mastra using Supabase
|
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript title="src/mastra/index.ts"
|
|
12
|
+
```typescript title="src/mastra/index.ts"
|
|
13
13
|
import { Mastra } from "@mastra/core";
|
|
14
14
|
import { MastraAuthSupabase } from "@mastra/auth-supabase";
|
|
15
15
|
|
|
16
16
|
export const mastra = new Mastra({
|
|
17
|
-
// ..
|
|
18
17
|
server: {
|
|
19
18
|
auth: new MastraAuthSupabase({
|
|
20
19
|
url: process.env.SUPABASE_URL,
|
|
@@ -9,12 +9,11 @@ The `MastraAuthWorkos` class provides authentication for Mastra using WorkOS. It
|
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript title="src/mastra/index.ts"
|
|
12
|
+
```typescript title="src/mastra/index.ts"
|
|
13
13
|
import { Mastra } from "@mastra/core";
|
|
14
14
|
import { MastraAuthWorkos } from "@mastra/auth-workos";
|
|
15
15
|
|
|
16
16
|
export const mastra = new Mastra({
|
|
17
|
-
// ..
|
|
18
17
|
server: {
|
|
19
18
|
auth: new MastraAuthWorkos({
|
|
20
19
|
apiKey: process.env.WORKOS_API_KEY,
|
|
@@ -15,28 +15,28 @@ The `create-mastra` command **creates** a new standalone Mastra project. Use thi
|
|
|
15
15
|
<Tabs>
|
|
16
16
|
<TabItem value="npm" label="npm">
|
|
17
17
|
|
|
18
|
-
```bash
|
|
18
|
+
```bash
|
|
19
19
|
npx create-mastra@beta
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
</TabItem>
|
|
23
23
|
<TabItem value="yarn" label="yarn">
|
|
24
24
|
|
|
25
|
-
```bash
|
|
25
|
+
```bash
|
|
26
26
|
yarn dlx create-mastra@beta
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
</TabItem>
|
|
30
30
|
<TabItem value="pnpm" label="pnpm">
|
|
31
31
|
|
|
32
|
-
```bash
|
|
32
|
+
```bash
|
|
33
33
|
pnpm create mastra@beta
|
|
34
34
|
```
|
|
35
35
|
|
|
36
36
|
</TabItem>
|
|
37
37
|
<TabItem value="bun" label="bun">
|
|
38
38
|
|
|
39
|
-
```bash
|
|
39
|
+
```bash
|
|
40
40
|
bun create mastra@beta
|
|
41
41
|
```
|
|
42
42
|
|
|
@@ -48,28 +48,28 @@ bun create mastra@beta
|
|
|
48
48
|
<Tabs>
|
|
49
49
|
<TabItem value="npm" label="npm">
|
|
50
50
|
|
|
51
|
-
```bash
|
|
51
|
+
```bash
|
|
52
52
|
npx create-mastra@beta my-mastra-project -- --template coding-agent
|
|
53
53
|
```
|
|
54
54
|
|
|
55
55
|
</TabItem>
|
|
56
56
|
<TabItem value="yarn" label="yarn">
|
|
57
57
|
|
|
58
|
-
```bash
|
|
58
|
+
```bash
|
|
59
59
|
yarn dlx create-mastra@beta --template coding-agent
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
</TabItem>
|
|
63
63
|
<TabItem value="pnpm" label="pnpm">
|
|
64
64
|
|
|
65
|
-
```bash
|
|
65
|
+
```bash
|
|
66
66
|
pnpm create mastra@beta --template coding-agent
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
</TabItem>
|
|
70
70
|
<TabItem value="bun" label="bun">
|
|
71
71
|
|
|
72
|
-
```bash
|
|
72
|
+
```bash
|
|
73
73
|
bun create mastra@beta --template coding-agent
|
|
74
74
|
```
|
|
75
75
|
|
|
@@ -183,12 +183,12 @@ By default, Mastra collects anonymous information about your project like your O
|
|
|
183
183
|
|
|
184
184
|
You can opt out of the CLI analytics by setting an environment variable:
|
|
185
185
|
|
|
186
|
-
```bash
|
|
186
|
+
```bash
|
|
187
187
|
MASTRA_TELEMETRY_DISABLED=1
|
|
188
188
|
```
|
|
189
189
|
|
|
190
190
|
You can also set this while using other `mastra` commands:
|
|
191
191
|
|
|
192
|
-
```bash
|
|
192
|
+
```bash
|
|
193
193
|
MASTRA_TELEMETRY_DISABLED=1 npx create-mastra@beta
|
|
194
194
|
```
|
|
@@ -41,7 +41,7 @@ You can set certain environment variables to modify the behavior of `mastra dev`
|
|
|
41
41
|
|
|
42
42
|
Set `MASTRA_DEV_NO_CACHE=1` to force a full rebuild rather than using the cached assets under `.mastra/`:
|
|
43
43
|
|
|
44
|
-
```bash
|
|
44
|
+
```bash
|
|
45
45
|
MASTRA_DEV_NO_CACHE=1 mastra dev
|
|
46
46
|
```
|
|
47
47
|
|
|
@@ -51,7 +51,7 @@ This helps when you are debugging bundler plugins or suspect stale output.
|
|
|
51
51
|
|
|
52
52
|
`MASTRA_CONCURRENCY` caps how many expensive operations run in parallel (primarily build and evaluation steps). For example:
|
|
53
53
|
|
|
54
|
-
```bash
|
|
54
|
+
```bash
|
|
55
55
|
MASTRA_CONCURRENCY=4 mastra dev
|
|
56
56
|
```
|
|
57
57
|
|
|
@@ -61,7 +61,7 @@ Leave it unset to let the CLI pick a sensible default for the machine.
|
|
|
61
61
|
|
|
62
62
|
When using providers supported by the Vercel AI SDK you can redirect requests through proxies or internal gateways by setting a base URL. For OpenAI:
|
|
63
63
|
|
|
64
|
-
```bash
|
|
64
|
+
```bash
|
|
65
65
|
OPENAI_API_KEY=<your-api-key> \
|
|
66
66
|
OPENAI_BASE_URL=https://openrouter.example/v1 \
|
|
67
67
|
mastra dev
|
|
@@ -69,7 +69,7 @@ mastra dev
|
|
|
69
69
|
|
|
70
70
|
For Anthropic:
|
|
71
71
|
|
|
72
|
-
```bash
|
|
72
|
+
```bash
|
|
73
73
|
ANTHROPIC_API_KEY=<your-api-key> \
|
|
74
74
|
ANTHROPIC_BASE_URL=https://anthropic.internal \
|
|
75
75
|
mastra dev
|
|
@@ -98,7 +98,7 @@ You can set certain environment variables to modify the behavior of `mastra buil
|
|
|
98
98
|
|
|
99
99
|
For CI or when running in resource constrained environments you can cap how many expensive tasks run at once by setting `MASTRA_CONCURRENCY`.
|
|
100
100
|
|
|
101
|
-
```bash
|
|
101
|
+
```bash
|
|
102
102
|
MASTRA_CONCURRENCY=2 mastra build
|
|
103
103
|
```
|
|
104
104
|
|
|
@@ -152,13 +152,13 @@ Read the [Scorers overview](/docs/v1/evals/overview) to learn more.
|
|
|
152
152
|
|
|
153
153
|
Add a new scorer to your project. You can use an interactive prompt:
|
|
154
154
|
|
|
155
|
-
```bash
|
|
155
|
+
```bash
|
|
156
156
|
mastra scorers add
|
|
157
157
|
```
|
|
158
158
|
|
|
159
159
|
Or provide a scorer name directly:
|
|
160
160
|
|
|
161
|
-
```bash
|
|
161
|
+
```bash
|
|
162
162
|
mastra scorers add answer-relevancy
|
|
163
163
|
```
|
|
164
164
|
|
|
@@ -258,13 +258,13 @@ By default, Mastra collects anonymous information about your project like your O
|
|
|
258
258
|
|
|
259
259
|
You can opt out of the CLI analytics by setting an environment variable:
|
|
260
260
|
|
|
261
|
-
```bash
|
|
261
|
+
```bash
|
|
262
262
|
MASTRA_TELEMETRY_DISABLED=1
|
|
263
263
|
```
|
|
264
264
|
|
|
265
265
|
You can also set this while using other `mastra` commands:
|
|
266
266
|
|
|
267
|
-
```bash
|
|
267
|
+
```bash
|
|
268
268
|
MASTRA_TELEMETRY_DISABLED=1 mastra dev
|
|
269
269
|
```
|
|
270
270
|
|
|
@@ -24,7 +24,6 @@ Get an instance of a specific agent by its ID:
|
|
|
24
24
|
```typescript title="src/mastra/agents/my-agent.ts"
|
|
25
25
|
export const myAgent = new Agent({
|
|
26
26
|
id: "my-agent",
|
|
27
|
-
// ...
|
|
28
27
|
});
|
|
29
28
|
```
|
|
30
29
|
|
|
@@ -123,7 +122,7 @@ while (true) {
|
|
|
123
122
|
|
|
124
123
|
To stream AI SDK-formatted parts on the client from an `agent.stream(...)` response, wrap `response.processDataStream` into a `ReadableStream<ChunkType>` and use `toAISdkStream`:
|
|
125
124
|
|
|
126
|
-
```typescript title="client-ai-sdk-transform.ts"
|
|
125
|
+
```typescript title="client-ai-sdk-transform.ts"
|
|
127
126
|
import { createUIMessageStream } from "ai";
|
|
128
127
|
import { toAISdkStream } from "@mastra/ai-sdk";
|
|
129
128
|
import type { ChunkType, MastraModelOutput } from "@mastra/core/stream";
|
|
@@ -9,7 +9,7 @@ The Mastra Client SDK provides a simple and type-safe interface for interacting
|
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript title="lib/mastra/mastra-client.ts"
|
|
12
|
+
```typescript title="lib/mastra/mastra-client.ts"
|
|
13
13
|
import { MastraClient } from "@mastra/client-js";
|
|
14
14
|
|
|
15
15
|
export const mastraClient = new MastraClient({
|
|
@@ -9,7 +9,7 @@ The `.getMemory()` method retrieves a memory instance from the Mastra registry b
|
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript
|
|
12
|
+
```typescript
|
|
13
13
|
const memory = mastra.getMemory("conversationMemory");
|
|
14
14
|
|
|
15
15
|
// Use the memory instance
|
|
@@ -47,7 +47,7 @@ const thread = await memory.createThread({
|
|
|
47
47
|
|
|
48
48
|
## Example: Registering and Retrieving Memory
|
|
49
49
|
|
|
50
|
-
```typescript
|
|
50
|
+
```typescript
|
|
51
51
|
import { Mastra } from "@mastra/core";
|
|
52
52
|
import { Memory } from "@mastra/memory";
|
|
53
53
|
import { LibSQLStore } from "@mastra/libsql";
|
|
@@ -9,7 +9,7 @@ The `.getStorage()` method is used to retrieve the storage instance that has bee
|
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript
|
|
12
|
+
```typescript
|
|
13
13
|
mastra.getStorage();
|
|
14
14
|
```
|
|
15
15
|
|
|
@@ -32,5 +32,5 @@ This method does not accept any parameters.
|
|
|
32
32
|
|
|
33
33
|
## Related
|
|
34
34
|
|
|
35
|
-
- [Storage overview](/
|
|
35
|
+
- [Storage overview](/reference/v1/storage/overview)
|
|
36
36
|
- [Storage reference](/reference/v1/storage/libsql)
|
|
@@ -9,7 +9,7 @@ The `.getStoredAgentById()` method retrieves an agent configuration from storage
|
|
|
9
9
|
|
|
10
10
|
## Usage example
|
|
11
11
|
|
|
12
|
-
```typescript
|
|
12
|
+
```typescript
|
|
13
13
|
// Get an Agent instance from storage
|
|
14
14
|
const agent = await mastra.getStoredAgentById("my-stored-agent");
|
|
15
15
|
|
|
@@ -19,7 +19,7 @@ if (agent) {
|
|
|
19
19
|
}
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
```typescript
|
|
22
|
+
```typescript
|
|
23
23
|
// Get the raw storage data instead of an Agent instance
|
|
24
24
|
const storedConfig = await mastra.getStoredAgentById("my-stored-agent", { raw: true });
|
|
25
25
|
|
|
@@ -179,5 +179,5 @@ When using `raw: true`, the returned object has the following structure:
|
|
|
179
179
|
## Related
|
|
180
180
|
|
|
181
181
|
- [Mastra.listStoredAgents()](/reference/v1/core/listStoredAgents)
|
|
182
|
-
- [Storage overview](/
|
|
182
|
+
- [Storage overview](/reference/v1/storage/overview)
|
|
183
183
|
- [Agents overview](/docs/v1/agents/overview)
|