@mastra/mcp-docs-server 1.2.15-alpha.19 → 1.2.15-alpha.21
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/docs/agents/code-mode.md +1 -1
- package/.docs/docs/agents/networks.md +2 -2
- package/.docs/docs/agents/overview.md +2 -2
- package/.docs/docs/agents/using-tools.md +1 -1
- package/.docs/docs/browser/overview.md +8 -8
- package/.docs/docs/browser/recording.md +2 -2
- package/.docs/docs/capabilities/{channels/overview.md → channels.md} +70 -7
- package/.docs/docs/capabilities/subagents.md +2 -2
- package/.docs/docs/deployment/cloud-providers.md +9 -9
- package/.docs/docs/deployment/overview.md +9 -9
- package/.docs/docs/deployment/sandbox.md +3 -3
- package/.docs/docs/deployment/web-framework.md +6 -6
- package/.docs/docs/deployment/workflow-runners.md +2 -2
- package/.docs/docs/harness/agent-controller.md +2 -2
- package/.docs/docs/index.md +8 -8
- package/.docs/docs/long-running-agents/durable-agents.md +2 -2
- package/.docs/docs/long-running-agents/signal-providers.md +2 -15
- package/.docs/docs/long-running-agents/signals.md +1 -1
- package/.docs/docs/mastra-platform/database.md +2 -2
- package/.docs/docs/mastra-platform/deploy.md +27 -0
- package/.docs/docs/mastra-platform/server.md +1 -1
- package/.docs/docs/mastra-platform/trace-intelligence.md +9 -13
- package/.docs/docs/mcp/overview.md +42 -0
- package/.docs/docs/memory/memory-processors.md +5 -5
- package/.docs/docs/memory/message-history.md +1 -1
- package/.docs/docs/memory/observational-memory.md +1 -1
- package/.docs/docs/observability/integrations/exporters/mastra-storage.md +16 -16
- package/.docs/docs/observability/integrations/overview.md +3 -3
- package/.docs/docs/server/auth/fga.md +1 -1
- package/.docs/docs/server/auth/simple-auth.md +1 -1
- package/.docs/docs/server/auth.md +8 -8
- package/.docs/docs/server/custom-api-routes.md +35 -0
- package/.docs/docs/storage/overview.md +14 -13
- package/.docs/docs/studio/observability.md +1 -1
- package/.docs/docs/workflows/overview.md +1 -1
- package/.docs/docs/workflows/snapshots.md +11 -11
- package/.docs/docs/workflows/time-travel.md +2 -0
- package/.docs/docs/workspace/filesystem.md +15 -15
- package/.docs/docs/workspace/sandbox.md +17 -17
- package/.docs/docs/workspace/search.md +1 -1
- package/.docs/guides/agent-frameworks/ai-sdk.md +2 -2
- package/.docs/guides/deployment/mastra-workers.md +1 -1
- package/.docs/guides/getting-started/quickstart.md +3 -3
- package/.docs/guides/index.md +8 -8
- package/.docs/guides/voice/overview.md +55 -106
- package/.docs/guides/voice/speech-to-text.md +7 -7
- package/.docs/guides/voice/text-to-speech.md +9 -10
- package/.docs/{guides/build-your-ui → integrations/agentic-ui}/ai-sdk-ui.md +2 -2
- package/.docs/{guides/build-your-ui/copilotkit/overview.md → integrations/agentic-ui/copilotkit.md} +256 -3
- package/.docs/{docs/browser → integrations/browsers}/agent-browser.md +2 -2
- package/.docs/{docs/browser → integrations/browsers}/browser-viewer.md +3 -3
- package/.docs/{docs/browser → integrations/browsers}/firecrawl.md +2 -2
- package/.docs/{docs/browser → integrations/browsers}/stagehand.md +1 -1
- package/.docs/{docs/capabilities → integrations}/channels/discord.md +2 -2
- package/.docs/integrations/channels/github.md +103 -0
- package/.docs/{docs/capabilities → integrations}/channels/imessage.md +7 -5
- package/.docs/{docs/capabilities → integrations}/channels/slack.md +4 -4
- package/.docs/{docs/capabilities → integrations}/channels/teams.md +2 -2
- package/.docs/{docs/capabilities → integrations}/channels/telegram.md +2 -2
- package/.docs/{docs/capabilities → integrations}/channels/whatsapp.md +2 -2
- package/.docs/{reference/storage/dsql.md → integrations/databases/aurora-dsql.md} +1 -1
- package/.docs/{reference/storage → integrations/databases}/clickhouse.md +2 -2
- package/.docs/{reference/storage → integrations/databases}/cloudflare-d1.md +1 -1
- package/.docs/{reference/storage/cloudflare.md → integrations/databases/cloudflare-kv.md} +1 -1
- package/.docs/{reference/storage → integrations/databases}/convex.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/duckdb.md +5 -5
- package/.docs/{reference/storage → integrations/databases}/dynamodb.md +1 -1
- package/.docs/{reference/storage/lance.md → integrations/databases/lancedb.md} +1 -1
- package/.docs/{reference/storage → integrations/databases}/libsql.md +2 -2
- package/.docs/{reference/storage → integrations/databases}/mongodb.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/mssql.md +1 -1
- package/.docs/integrations/databases/neon.md +220 -0
- package/.docs/{reference/storage → integrations/databases}/oracledb.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/postgresql.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/redis.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/spanner.md +1 -1
- package/.docs/{reference/storage → integrations/databases}/upstash.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/aws-bedrock-agentcore.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/aws-lambda.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/azure-app-services.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/cloudflare.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/digital-ocean.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/netlify.md +1 -1
- package/.docs/{guides/deployment → integrations/deploy}/vercel.md +2 -2
- package/.docs/{reference/workspace/s3-filesystem.md → integrations/file-storage/amazon-s3.md} +5 -5
- package/.docs/{reference/workspace/archil-filesystem.md → integrations/file-storage/archil.md} +3 -3
- package/.docs/{reference/workspace/azure-blob-filesystem.md → integrations/file-storage/azure-blob.md} +2 -2
- package/.docs/{reference/workspace/gcs-filesystem.md → integrations/file-storage/google-cloud-storage.md} +5 -5
- package/.docs/{reference/workspace/mesa-filesystem.md → integrations/file-storage/mesa.md} +1 -1
- package/.docs/{reference/workspace/files-sdk-filesystem.md → integrations/file-storage/vercel-files.md} +5 -5
- package/.docs/{guides/getting-started → integrations/frameworks}/astro.md +1 -1
- package/.docs/{guides/getting-started → integrations/frameworks}/electron.md +1 -1
- package/.docs/{guides/getting-started → integrations/frameworks}/next-js.md +2 -2
- package/.docs/{guides/getting-started → integrations/frameworks}/nuxt.md +1 -1
- package/.docs/{guides/getting-started → integrations/frameworks}/sveltekit.md +1 -1
- package/.docs/{guides/getting-started → integrations/frameworks}/vite-react.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/arize.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/arthur.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/braintrust.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/confident-ai.md +1 -1
- package/.docs/integrations/observability/datadog.md +538 -0
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/laminar.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/langfuse.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/langsmith.md +1 -1
- package/.docs/{docs/observability/integrations/exporters/otel.md → integrations/observability/opentelemetry.md} +276 -44
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/posthog.md +1 -1
- package/.docs/{docs/observability/integrations/exporters → integrations/observability}/sentry.md +1 -1
- package/.docs/{reference/workspace/apple-container-sandbox.md → integrations/sandboxes/apple-container.md} +1 -1
- package/.docs/{reference/workspace/daytona-sandbox.md → integrations/sandboxes/daytona.md} +2 -2
- package/.docs/{reference/workspace/docker-sandbox.md → integrations/sandboxes/docker.md} +1 -1
- package/.docs/{reference/workspace/e2b-sandbox.md → integrations/sandboxes/e2b.md} +3 -3
- package/.docs/{reference/workspace/modal-sandbox.md → integrations/sandboxes/modal.md} +2 -2
- package/.docs/{reference/workspace/railway-sandbox.md → integrations/sandboxes/railway.md} +8 -0
- package/.docs/{reference/workspace/vercel-sandbox.md → integrations/sandboxes/vercel.md} +141 -12
- package/.docs/{reference → integrations}/tools/brightdata.md +1 -1
- package/.docs/{reference → integrations}/tools/perplexity.md +1 -1
- package/.docs/{reference → integrations}/tools/tavily.md +1 -1
- package/.docs/{reference → integrations}/voice/aws-nova-sonic.md +1 -1
- package/.docs/{reference → integrations}/voice/cloudflare.md +3 -3
- package/.docs/{reference/voice/google-gemini-live.md → integrations/voice/google.md} +305 -30
- package/.docs/{reference/voice/inworld-realtime.md → integrations/voice/inworld.md} +163 -25
- package/.docs/{reference → integrations}/voice/livekit.md +437 -34
- package/.docs/{reference/voice/openai-realtime.md → integrations/voice/openai.md} +117 -20
- package/.docs/integrations.md +147 -0
- package/.docs/models/embeddings.md +2 -2
- package/.docs/models/environment-variables.md +1 -0
- package/.docs/models/gateways/openrouter.md +4 -2
- package/.docs/models/gateways/vercel.md +2 -1
- package/.docs/models/index.md +1 -1
- package/.docs/models/providers/coralbricks.md +75 -0
- package/.docs/models/providers/evroc.md +2 -3
- package/.docs/models/providers/hyper.md +6 -6
- package/.docs/models/providers/kilo.md +7 -5
- package/.docs/models/providers/llmgateway.md +1 -2
- package/.docs/models/providers/nano-gpt.md +1 -3
- package/.docs/models/providers/opencode.md +0 -1
- package/.docs/models/providers/privatemode-ai.md +5 -4
- package/.docs/models/providers/snowflake-cortex.md +5 -1
- package/.docs/models/providers/wandb.md +2 -1
- package/.docs/models/providers/zenmux.md +0 -15
- package/.docs/models/providers.md +1 -0
- package/.docs/reference/agent-controller/agent-controller-class.md +32 -1
- package/.docs/reference/agents/channels.md +2 -2
- package/.docs/reference/agents/generateLegacy.md +2 -2
- package/.docs/reference/agents/getDefaultOptions.md +1 -1
- package/.docs/reference/agents/getDefaultStreamOptions.md +1 -1
- package/.docs/reference/agents/inngest-agent.md +1 -1
- package/.docs/reference/agents/network.md +1 -1
- package/.docs/reference/ai-sdk/handle-network-stream.md +1 -1
- package/.docs/reference/ai-sdk/network-route.md +1 -1
- package/.docs/reference/auth/auth0.md +1 -1
- package/.docs/reference/auth/better-auth.md +1 -1
- package/.docs/reference/auth/clerk.md +1 -1
- package/.docs/reference/auth/firebase.md +1 -1
- package/.docs/reference/auth/google.md +1 -1
- package/.docs/reference/auth/supabase.md +1 -1
- package/.docs/reference/auth/workos.md +1 -1
- package/.docs/reference/browser/agent-browser.md +1 -1
- package/.docs/reference/browser/browser-viewer.md +1 -1
- package/.docs/reference/browser/firecrawl-browser.md +1 -1
- package/.docs/reference/browser/stagehand-browser.md +1 -1
- package/.docs/reference/channels/channel-provider.md +1 -1
- package/.docs/reference/channels/slack-provider.md +2 -2
- package/.docs/reference/cli/mastra.md +2 -2
- package/.docs/reference/configuration.md +1 -26
- package/.docs/reference/core/getStorage.md +1 -1
- package/.docs/reference/core/getVector.md +2 -2
- package/.docs/reference/core/listVectors.md +2 -2
- package/.docs/reference/core/setStorage.md +1 -1
- package/.docs/reference/file-based-agents/storage.md +1 -1
- package/.docs/reference/file-based-agents/studio.md +1 -1
- package/.docs/reference/index.md +27 -55
- package/.docs/{guides → reference}/migrations/ai-sdk-v4-to-v5.md +1 -1
- package/.docs/{guides → reference}/migrations/mastra-cloud.md +1 -1
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/cli.md +1 -1
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/memory.md +1 -1
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/overview.md +41 -41
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/tools.md +1 -1
- package/.docs/{guides → reference}/migrations/upgrade-to-v1/tracing.md +10 -10
- package/.docs/reference/observability/tracing/bridges/datadog.md +2 -2
- package/.docs/reference/observability/tracing/bridges/otel.md +2 -2
- package/.docs/reference/observability/tracing/exporters/arize.md +1 -1
- package/.docs/reference/observability/tracing/exporters/arthur.md +1 -1
- package/.docs/reference/observability/tracing/exporters/confident-ai.md +1 -1
- package/.docs/reference/observability/tracing/exporters/mastra-platform-exporter.md +12 -0
- package/.docs/reference/observability/tracing/exporters/otel.md +2 -2
- package/.docs/reference/pubsub/lease-provider.md +1 -1
- package/.docs/{guides → reference}/rag/chunking-and-embedding.md +16 -19
- package/.docs/reference/rag/database-config.md +1 -1
- package/.docs/{guides/rag/graph-rag.md → reference/rag/graph-rag-guide.md} +1 -1
- package/.docs/{guides → reference}/rag/overview.md +2 -2
- package/.docs/{guides → reference}/rag/retrieval.md +1 -1
- package/.docs/{guides → reference}/rag/vector-databases.md +1 -1
- package/.docs/reference/server/create-route.md +27 -1
- package/.docs/reference/storage/composite.md +3 -3
- package/.docs/reference/storage/retention.md +4 -4
- package/.docs/reference/streaming/ChunkType.md +3 -3
- package/.docs/reference/streaming/agents/streamLegacy.md +3 -3
- package/.docs/reference/tools/mcp-server.md +1 -1
- package/.docs/reference/vectors/convex.md +2 -2
- package/.docs/reference/vectors/oracledb.md +2 -2
- package/.docs/reference/workers/overview.md +8 -8
- package/.docs/reference/workflows/run-methods/timeTravel.md +1 -0
- package/.docs/reference/workspace/platform-filesystem.md +2 -2
- package/.docs/reference/workspace/platform-sandbox.md +10 -2
- package/.docs/reference/workspace/process-manager.md +3 -3
- package/.docs/reference/workspace/sandbox.md +10 -0
- package/CHANGELOG.md +16 -0
- package/dist/index.js +1 -1
- package/dist/{src-BZcgzbk9.js → src-D-W-bx5t.js} +2 -2
- package/dist/{src-BZcgzbk9.js.map → src-D-W-bx5t.js.map} +1 -1
- package/dist/stdio.js +1 -1
- package/package.json +5 -5
- package/.docs/docs/capabilities/channels/other-adapters.md +0 -68
- package/.docs/docs/observability/integrations/bridges/datadog.md +0 -219
- package/.docs/docs/observability/integrations/bridges/otel.md +0 -234
- package/.docs/docs/observability/integrations/exporters/datadog.md +0 -321
- package/.docs/guides/build-your-ui/copilotkit/channels.md +0 -86
- package/.docs/guides/build-your-ui/copilotkit/generative-ui.md +0 -174
- package/.docs/guides/guide/chef-michel.md +0 -211
- package/.docs/guides/guide/publishing-mcp-server.md +0 -137
- package/.docs/guides/guide/slack-assistant.md +0 -193
- package/.docs/guides/guide/stock-agent.md +0 -132
- package/.docs/guides/guide/web-search.md +0 -322
- package/.docs/guides/guide/whatsapp-chat-bot.md +0 -407
- package/.docs/guides/voice/realtime-voice.md +0 -430
- package/.docs/reference/voice/google.md +0 -290
- package/.docs/reference/voice/inworld.md +0 -137
- package/.docs/reference/voice/openai.md +0 -96
- package/.docs/reference/voice/playai.md +0 -82
- package/.docs/reference/workspace/vercel-serverless.md +0 -128
- /package/.docs/{guides/concepts → docs/guides}/multi-agent-systems.md +0 -0
- /package/.docs/{guides/concepts → docs/guides}/streaming.md +0 -0
- /package/.docs/{guides/build-your-ui → integrations/agentic-ui}/assistant-ui.md +0 -0
- /package/.docs/{guides/build-your-ui → integrations/agentic-ui}/openui.md +0 -0
- /package/.docs/{docs/server → integrations}/auth/auth0.md +0 -0
- /package/.docs/{docs/server → integrations}/auth/better-auth.md +0 -0
- /package/.docs/{docs/server → integrations}/auth/clerk.md +0 -0
- /package/.docs/{docs/server → integrations}/auth/firebase.md +0 -0
- /package/.docs/{docs/server → integrations}/auth/google.md +0 -0
- /package/.docs/{docs/server → integrations}/auth/okta.md +0 -0
- /package/.docs/{docs/server → integrations}/auth/supabase.md +0 -0
- /package/.docs/{docs/server → integrations}/auth/workos.md +0 -0
- /package/.docs/{guides/deployment → integrations/deploy}/amazon-ec2.md +0 -0
- /package/.docs/{guides/deployment → integrations/deploy}/inngest.md +0 -0
- /package/.docs/{guides/deployment → integrations/deploy}/kubernetes.md +0 -0
- /package/.docs/{guides/deployment → integrations/deploy}/temporal.md +0 -0
- /package/.docs/{reference/workspace/agentfs-filesystem.md → integrations/file-storage/agentfs.md} +0 -0
- /package/.docs/{reference/workspace/google-drive-filesystem.md → integrations/file-storage/google-drive.md} +0 -0
- /package/.docs/{guides/getting-started → integrations/frameworks}/express.md +0 -0
- /package/.docs/{guides/getting-started → integrations/frameworks}/hono.md +0 -0
- /package/.docs/{guides/getting-started → integrations/frameworks}/nestjs.md +0 -0
- /package/.docs/{reference/workspace/agentcore-runtime-sandbox.md → integrations/sandboxes/agentcore.md} +0 -0
- /package/.docs/{reference/workspace/blaxel-sandbox.md → integrations/sandboxes/blaxel.md} +0 -0
- /package/.docs/{guides/guide → integrations/tools}/firecrawl.md +0 -0
- /package/.docs/{reference → integrations}/voice/azure.md +0 -0
- /package/.docs/{reference → integrations}/voice/deepgram.md +0 -0
- /package/.docs/{reference → integrations}/voice/elevenlabs.md +0 -0
- /package/.docs/{reference → integrations}/voice/mistral.md +0 -0
- /package/.docs/{reference → integrations}/voice/murf.md +0 -0
- /package/.docs/{reference → integrations}/voice/sarvam.md +0 -0
- /package/.docs/{reference → integrations}/voice/speechify.md +0 -0
- /package/.docs/{reference/voice/xai-realtime.md → integrations/voice/xai.md} +0 -0
- /package/.docs/{guides/getting-started → reference}/manual-install.md +0 -0
- /package/.docs/{guides → reference}/migrations/agentnetwork.md +0 -0
- /package/.docs/{guides → reference}/migrations/network-to-supervisor.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/agent.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/client.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/deployment.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/evals.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/mastra.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/mcp.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/processors.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/rag.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/storage.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/vectors.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/voice.md +0 -0
- /package/.docs/{guides → reference}/migrations/upgrade-to-v1/workflows.md +0 -0
- /package/.docs/{guides → reference}/migrations/vnext-to-standard-apis.md +0 -0
|
@@ -1,321 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# Datadog exporter
|
|
4
|
-
|
|
5
|
-
[Datadog](https://datadoghq.com/) is a complete monitoring platform with dedicated LLM Observability features. The Datadog exporter sends your traces to Datadog's LLM Observability product, providing insights into model performance and token usage, plus conversation flows.
|
|
6
|
-
|
|
7
|
-
> **Also using dd-trace APM?:** If you also use `dd-trace` APM auto-instrumentation, consider the [Datadog Bridge](https://mastra.ai/docs/observability/integrations/bridges/datadog) instead. The bridge creates `dd-trace` spans in real time so HTTP and database calls inside tools and processors are correctly nested under their parent Mastra span. The exporter on its own sends LLM Observability data after execution completes, which means auto-instrumented APM spans fall back to the request handler.
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
**npm**:
|
|
12
|
-
|
|
13
|
-
```bash
|
|
14
|
-
npm install @mastra/datadog@latest
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
**pnpm**:
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
pnpm add @mastra/datadog@latest
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
**Yarn**:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
yarn add @mastra/datadog@latest
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**Bun**:
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
bun add @mastra/datadog@latest
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Configuration
|
|
36
|
-
|
|
37
|
-
### Prerequisites
|
|
38
|
-
|
|
39
|
-
1. **Datadog Account**: Sign up at [datadoghq.com](https://datadoghq.com/) with LLM Observability enabled
|
|
40
|
-
2. **API Key**: Get your API key from Datadog Organization Settings → API Keys
|
|
41
|
-
3. **Environment Variables**: Set your credentials
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
DD_API_KEY=your-datadog-api-key
|
|
45
|
-
DD_LLMOBS_ML_APP=my-llm-app
|
|
46
|
-
DD_SITE=datadoghq.com # Optional: defaults to datadoghq.com
|
|
47
|
-
DD_ENV=production # Optional: environment name
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Zero-Config Setup
|
|
51
|
-
|
|
52
|
-
With environment variables set, use the exporter with no configuration:
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
import { Mastra } from '@mastra/core'
|
|
56
|
-
import { Observability } from '@mastra/observability'
|
|
57
|
-
import { DatadogExporter } from '@mastra/datadog'
|
|
58
|
-
|
|
59
|
-
export const mastra = new Mastra({
|
|
60
|
-
observability: new Observability({
|
|
61
|
-
configs: {
|
|
62
|
-
datadog: {
|
|
63
|
-
serviceName: 'my-service',
|
|
64
|
-
exporters: [new DatadogExporter()],
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
}),
|
|
68
|
-
})
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Explicit Configuration
|
|
72
|
-
|
|
73
|
-
You can also pass credentials directly (takes precedence over environment variables):
|
|
74
|
-
|
|
75
|
-
```typescript
|
|
76
|
-
import { Mastra } from '@mastra/core'
|
|
77
|
-
import { Observability } from '@mastra/observability'
|
|
78
|
-
import { DatadogExporter } from '@mastra/datadog'
|
|
79
|
-
|
|
80
|
-
export const mastra = new Mastra({
|
|
81
|
-
observability: new Observability({
|
|
82
|
-
configs: {
|
|
83
|
-
datadog: {
|
|
84
|
-
serviceName: 'my-service',
|
|
85
|
-
exporters: [
|
|
86
|
-
new DatadogExporter({
|
|
87
|
-
mlApp: process.env.DD_LLMOBS_ML_APP!,
|
|
88
|
-
apiKey: process.env.DD_API_KEY!,
|
|
89
|
-
}),
|
|
90
|
-
],
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
}),
|
|
94
|
-
})
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## Configuration options
|
|
98
|
-
|
|
99
|
-
### Complete Configuration
|
|
100
|
-
|
|
101
|
-
```typescript
|
|
102
|
-
new DatadogExporter({
|
|
103
|
-
// Required settings
|
|
104
|
-
mlApp: process.env.DD_LLMOBS_ML_APP!, // Groups traces under this ML app name
|
|
105
|
-
apiKey: process.env.DD_API_KEY!, // Required for agentless mode (default)
|
|
106
|
-
|
|
107
|
-
// Optional settings
|
|
108
|
-
site: 'datadoghq.com', // Datadog site (datadoghq.eu, us3.datadoghq.com, etc.)
|
|
109
|
-
service: 'my-service', // Service name (defaults to mlApp)
|
|
110
|
-
env: 'production', // Environment name
|
|
111
|
-
agentless: true, // true = direct HTTPS, false = local Datadog Agent
|
|
112
|
-
|
|
113
|
-
// Advanced settings
|
|
114
|
-
integrationsEnabled: false, // Enable dd-trace auto-instrumentation
|
|
115
|
-
|
|
116
|
-
// Diagnostic logging
|
|
117
|
-
logLevel: 'info', // debug | info | warn | error
|
|
118
|
-
})
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### With Local Datadog Agent
|
|
122
|
-
|
|
123
|
-
If you have a Datadog Agent running locally, you can route traces through it instead of direct HTTPS:
|
|
124
|
-
|
|
125
|
-
```typescript
|
|
126
|
-
new DatadogExporter({
|
|
127
|
-
mlApp: process.env.DD_LLMOBS_ML_APP!,
|
|
128
|
-
agentless: false, // Use local Datadog Agent
|
|
129
|
-
env: 'production',
|
|
130
|
-
})
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
Note: When using agent mode, the API key is read from the local agent's configuration.
|
|
134
|
-
|
|
135
|
-
## Span type mapping
|
|
136
|
-
|
|
137
|
-
Mastra span types are automatically mapped to Datadog LLM Observability span kinds:
|
|
138
|
-
|
|
139
|
-
| Mastra SpanType | Datadog Kind |
|
|
140
|
-
| -------------------- | ------------ |
|
|
141
|
-
| `AGENT_RUN` | `agent` |
|
|
142
|
-
| `MODEL_GENERATION` | `workflow` |
|
|
143
|
-
| `MODEL_STEP` | `llm` |
|
|
144
|
-
| `TOOL_CALL` | `tool` |
|
|
145
|
-
| `MCP_TOOL_CALL` | `tool` |
|
|
146
|
-
| `WORKFLOW_RUN` | `workflow` |
|
|
147
|
-
| Other workflow types | `task` |
|
|
148
|
-
| `GENERIC` | `task` |
|
|
149
|
-
|
|
150
|
-
Other/future Mastra span types will default to 'task' when mapped unless specified.
|
|
151
|
-
|
|
152
|
-
## Application Performance Monitoring
|
|
153
|
-
|
|
154
|
-
The sections above cover Mastra's [LLM Observability](https://docs.datadoghq.com/llm_observability/) integration. To trace your Mastra HTTP server routes (request latency, error tracking, service maps), use `dd-trace` directly for Datadog Application Performance Monitoring (APM).
|
|
155
|
-
|
|
156
|
-
### Prerequisites
|
|
157
|
-
|
|
158
|
-
1. **Datadog Agent**: Install a [Datadog Agent](https://docs.datadoghq.com/agent/) on the same host or accessible via network. The agent receives traces from `dd-trace` on `localhost:8126` and forwards them to Datadog. Follow the [agent installation guide](https://docs.datadoghq.com/agent/) to set it up.
|
|
159
|
-
|
|
160
|
-
2. **dd-trace package**: Install the tracing library in your project:
|
|
161
|
-
|
|
162
|
-
**npm**:
|
|
163
|
-
|
|
164
|
-
```bash
|
|
165
|
-
npm install dd-trace
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
**pnpm**:
|
|
169
|
-
|
|
170
|
-
```bash
|
|
171
|
-
pnpm add dd-trace
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
**Yarn**:
|
|
175
|
-
|
|
176
|
-
```bash
|
|
177
|
-
yarn add dd-trace
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
**Bun**:
|
|
181
|
-
|
|
182
|
-
```bash
|
|
183
|
-
bun add dd-trace
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
> **Note:** APM traces always route through the Datadog Agent. This is different from LLM Observability, which supports agentless mode (direct HTTPS to Datadog).
|
|
187
|
-
|
|
188
|
-
### APM only
|
|
189
|
-
|
|
190
|
-
Import and initialize `dd-trace` at the top of your entry file, before any other imports:
|
|
191
|
-
|
|
192
|
-
```typescript
|
|
193
|
-
import tracer from 'dd-trace'
|
|
194
|
-
|
|
195
|
-
tracer.init({
|
|
196
|
-
service: process.env.DD_SERVICE || 'my-mastra-app',
|
|
197
|
-
env: process.env.DD_ENV || 'production',
|
|
198
|
-
version: process.env.DD_VERSION,
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
import { Mastra } from '@mastra/core'
|
|
202
|
-
|
|
203
|
-
export const mastra = new Mastra({
|
|
204
|
-
bundler: {
|
|
205
|
-
externals: [
|
|
206
|
-
'dd-trace',
|
|
207
|
-
'@datadog/native-metrics',
|
|
208
|
-
'@datadog/native-appsec',
|
|
209
|
-
'@datadog/native-iast-taint-tracking',
|
|
210
|
-
'@datadog/pprof',
|
|
211
|
-
],
|
|
212
|
-
},
|
|
213
|
-
})
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
Set the tracer metadata environment variables:
|
|
217
|
-
|
|
218
|
-
```bash
|
|
219
|
-
DD_SERVICE=my-mastra-app
|
|
220
|
-
DD_ENV=production
|
|
221
|
-
DD_VERSION=1.0.0
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
`dd-trace` auto-instruments popular HTTP frameworks, including those supported by Mastra's [server adapters](https://mastra.ai/docs/server/server-adapters). Inbound requests, outbound HTTP calls, and database queries appear as APM traces in Datadog.
|
|
225
|
-
|
|
226
|
-
### APM and LLM Observability
|
|
227
|
-
|
|
228
|
-
Import and initialize `dd-trace` before creating the Mastra instance. The `DatadogExporter` detects the existing tracer and skips re-initialization, adding LLM Observability on top of your APM setup:
|
|
229
|
-
|
|
230
|
-
```typescript
|
|
231
|
-
import tracer from 'dd-trace'
|
|
232
|
-
|
|
233
|
-
tracer.init({
|
|
234
|
-
service: process.env.DD_SERVICE || 'my-mastra-app',
|
|
235
|
-
env: process.env.DD_ENV || 'production',
|
|
236
|
-
version: process.env.DD_VERSION,
|
|
237
|
-
})
|
|
238
|
-
|
|
239
|
-
import { Mastra } from '@mastra/core'
|
|
240
|
-
import { Observability } from '@mastra/observability'
|
|
241
|
-
import { DatadogExporter } from '@mastra/datadog'
|
|
242
|
-
|
|
243
|
-
export const mastra = new Mastra({
|
|
244
|
-
observability: new Observability({
|
|
245
|
-
configs: {
|
|
246
|
-
datadog: {
|
|
247
|
-
serviceName: 'my-mastra-app',
|
|
248
|
-
exporters: [
|
|
249
|
-
new DatadogExporter({
|
|
250
|
-
mlApp: process.env.DD_LLMOBS_ML_APP!,
|
|
251
|
-
apiKey: process.env.DD_API_KEY!,
|
|
252
|
-
}),
|
|
253
|
-
],
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
|
-
}),
|
|
257
|
-
bundler: {
|
|
258
|
-
externals: [
|
|
259
|
-
'dd-trace',
|
|
260
|
-
'@datadog/native-metrics',
|
|
261
|
-
'@datadog/native-appsec',
|
|
262
|
-
'@datadog/native-iast-taint-tracking',
|
|
263
|
-
'@datadog/pprof',
|
|
264
|
-
],
|
|
265
|
-
},
|
|
266
|
-
})
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
```bash
|
|
270
|
-
DD_SERVICE=my-mastra-app
|
|
271
|
-
DD_ENV=production
|
|
272
|
-
DD_VERSION=1.0.0
|
|
273
|
-
DD_API_KEY=your-datadog-api-key
|
|
274
|
-
DD_LLMOBS_ML_APP=my-llm-app
|
|
275
|
-
```
|
|
276
|
-
|
|
277
|
-
Server routes appear as APM traces and LLM calls appear as LLM Observability spans, all under the same service in Datadog.
|
|
278
|
-
|
|
279
|
-
> **Note:** Import and initialize `dd-trace` before all other modules. This allows its auto-instrumentation to patch HTTP, database, and framework libraries at load time.
|
|
280
|
-
|
|
281
|
-
## Troubleshooting
|
|
282
|
-
|
|
283
|
-
### Native module ABI mismatch
|
|
284
|
-
|
|
285
|
-
If you see errors like:
|
|
286
|
-
|
|
287
|
-
```text
|
|
288
|
-
Error: No native build was found for runtime=node abi=137 platform=linuxglibc arch=x64
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
This indicates a Node.js version compatibility issue with `dd-trace`'s native modules. These native modules are **optional** and provide performance monitoring features.
|
|
292
|
-
|
|
293
|
-
**Solutions:**
|
|
294
|
-
|
|
295
|
-
1. **Use Node.js 22.x**: Native modules have the best compatibility with Node.js 22.x.
|
|
296
|
-
|
|
297
|
-
2. **Ignore native module warnings**: The native modules (`@datadog/native-metrics`, `@datadog/native-appsec`, etc.) are optional. If they fail to load, core tracing functionality still works.
|
|
298
|
-
|
|
299
|
-
### Bundler externals configuration
|
|
300
|
-
|
|
301
|
-
When using bundlers like esbuild, webpack, or the Mastra CLI bundler, you may need to mark `dd-trace` and its dependencies as external:
|
|
302
|
-
|
|
303
|
-
```typescript
|
|
304
|
-
export const mastra = new Mastra({
|
|
305
|
-
bundler: {
|
|
306
|
-
externals: [
|
|
307
|
-
'dd-trace',
|
|
308
|
-
'@datadog/native-metrics',
|
|
309
|
-
'@datadog/native-appsec',
|
|
310
|
-
'@datadog/native-iast-taint-tracking',
|
|
311
|
-
'@datadog/pprof',
|
|
312
|
-
],
|
|
313
|
-
},
|
|
314
|
-
})
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
## Related
|
|
318
|
-
|
|
319
|
-
- [Tracing overview](https://mastra.ai/docs/observability/tracing/overview)
|
|
320
|
-
- [Datadog LLM Observability documentation](https://docs.datadoghq.com/llm_observability/)
|
|
321
|
-
- [Datadog APM documentation](https://docs.datadoghq.com/tracing/)
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# CopilotKit channels
|
|
4
|
-
|
|
5
|
-
The same Mastra agent that powers your in-app copilot can also run as a bot in messaging platforms. CopilotKit's Channels SDK connects your agent to Slack and other messaging platforms, with threads, tool calls, rich interactive messages, and human-in-the-loop approvals handled natively in the channel.
|
|
6
|
-
|
|
7
|
-
> **Note:** Full platform setup lives in the [CopilotKit Channels documentation](https://docs.copilotkit.ai/slack/mastra). This page shows how Channels fit together with a Mastra agent.
|
|
8
|
-
|
|
9
|
-
## How it fits together
|
|
10
|
-
|
|
11
|
-
Your Mastra agent stays where it's deployed, exposed over AG-UI through `registerCopilotKit()` (see [CopilotKit overview](https://mastra.ai/guides/build-your-ui/copilotkit/overview)). A channel is a separate long-running process built with `@copilotkit/channels`: you attach one or more platform adapters and point the channel at your agent. `createChannel` takes an array of adapters, so a single process can serve several platforms at once.
|
|
12
|
-
|
|
13
|
-
Install the SDK (batteries-included, every adapter):
|
|
14
|
-
|
|
15
|
-
**npm**:
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
npm install @copilotkit/channels
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
**pnpm**:
|
|
22
|
-
|
|
23
|
-
```bash
|
|
24
|
-
pnpm add @copilotkit/channels
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
**Yarn**:
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
|
-
yarn add @copilotkit/channels
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
**Bun**:
|
|
34
|
-
|
|
35
|
-
```bash
|
|
36
|
-
bun add @copilotkit/channels
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
import { createChannel, Message, Section } from '@copilotkit/channels'
|
|
41
|
-
import { slack } from '@copilotkit/channels/slack'
|
|
42
|
-
import { mastraAgent } from './agent' // your AG-UI Mastra agent
|
|
43
|
-
|
|
44
|
-
const channel = createChannel({
|
|
45
|
-
// Point the channel at your Mastra agent (an AbstractAgent, or a per-thread factory).
|
|
46
|
-
agent: mastraAgent,
|
|
47
|
-
adapters: [
|
|
48
|
-
slack({
|
|
49
|
-
botToken: process.env.SLACK_BOT_TOKEN!,
|
|
50
|
-
appToken: process.env.SLACK_APP_TOKEN!,
|
|
51
|
-
}),
|
|
52
|
-
],
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
channel.onMention(async ({ thread }) => {
|
|
56
|
-
await thread.runAgent()
|
|
57
|
-
})
|
|
58
|
-
|
|
59
|
-
await channel.start()
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
The agent receives ordinary AG-UI input and emits ordinary AG-UI events; the platform mechanics stay behind the adapter, so the same Mastra agent runs unchanged across every channel. Rich messages are written as JSX and rendered to each platform's native format (Block Kit on Slack, for example), so an interactive card degrades gracefully where a platform has no equivalent.
|
|
63
|
-
|
|
64
|
-
## Slack
|
|
65
|
-
|
|
66
|
-
The [Slack quickstart](https://docs.copilotkit.ai/slack/mastra) takes you from zero to a bot you can `@`-mention in a channel, then adds an interactive button card. Slack runs over Socket Mode, which opens an outbound WebSocket to Slack, so no public URL or tunnel is required during development.
|
|
67
|
-
|
|
68
|
-
Set the Slack credentials in your environment:
|
|
69
|
-
|
|
70
|
-
- `SLACK_BOT_TOKEN`: Bot User OAuth token (`xoxb-...`)
|
|
71
|
-
- `SLACK_APP_TOKEN`: App-level token with the `connections:write` scope (`xapp-...`)
|
|
72
|
-
|
|
73
|
-
## Other platforms
|
|
74
|
-
|
|
75
|
-
The Channels SDK isn't limited to Slack. Other platforms like Microsoft Teams run through the same `@copilotkit/channels` API: add the matching adapter to the `adapters` array and the rest of your agent code stays the same. See the [CopilotKit Channels documentation](https://docs.copilotkit.ai/slack/mastra) for the current platform list and per-platform setup.
|
|
76
|
-
|
|
77
|
-
## Message pipeline and architecture
|
|
78
|
-
|
|
79
|
-
Managed channels keep a deliberate credential split, which matters when your Mastra agent uses separate model keys and tools:
|
|
80
|
-
|
|
81
|
-
- **You keep** the agent logic, model credentials, tools, and the channel process.
|
|
82
|
-
- **CopilotKit Intelligence holds** the platform credentials, message delivery, registration, health, and reconnects.
|
|
83
|
-
|
|
84
|
-
A turn begins when a user messages the app. Intelligence receives the platform event, and the gateway delivers the turn to your running channel process. Your Mastra agent runs and renders a reply. Intelligence then returns the reply as native platform content. Platform credentials never enter the agent process, and enterprise Intelligence can be self-hosted for data residency.
|
|
85
|
-
|
|
86
|
-
> **Note:** By default, interactive actions live in memory and reset on restart. Back the channel with a durable action and state store (Redis or Postgres) so buttons and per-thread state survive restarts and span multiple instances.
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
> Discover all available pages from the documentation index: https://mastra.ai/llms.txt
|
|
2
|
-
|
|
3
|
-
# CopilotKit generative UI
|
|
4
|
-
|
|
5
|
-
Generative UI describes interfaces that agents help create and that users can interact with. CopilotKit organizes these interfaces along a single axis, the **generative UI spectrum**, which runs from author-controlled (you decide every pixel) to agent-invented (the agent owns the rendered surface). Your position on the axis is a trade-off between predictability and breadth.
|
|
6
|
-
|
|
7
|
-
The spectrum has three tiers:
|
|
8
|
-
|
|
9
|
-
| Tier | Who controls the surface | Primitives |
|
|
10
|
-
| --------------- | ------------------------------------------------------------------------------------------ | -------------------------------------------------------------------- |
|
|
11
|
-
| **Controlled** | You wrote the component. The agent picks which one to use and what data to pass. | Tool call rendering, state rendering, reasoning, components as tools |
|
|
12
|
-
| **Declarative** | The agent emits a structured spec. The frontend composes it from a catalog you registered. | A2UI (fixed-schema and flexible variants) |
|
|
13
|
-
| **Open-ended** | The UI is invented elsewhere (an MCP server) and you sandbox it. | MCP Apps |
|
|
14
|
-
|
|
15
|
-
Each tier is a Mastra agent exposed through `registerCopilotKit()` (see [CopilotKit overview](https://mastra.ai/guides/build-your-ui/copilotkit/overview)) plus the matching CopilotKit hook on the frontend. For the full concept, see CopilotKit's [generative UI spectrum](https://www.copilotkit.ai/generative-ui-spectrum) and [generative UI overview](https://docs.copilotkit.ai/concepts/generative-ui-overview).
|
|
16
|
-
|
|
17
|
-
> **Tip:** Mastra's [UI Dojo](https://ui-dojo.mastra.ai/) has working CopilotKit examples. Browse the source under `src/pages/copilot-kit`.
|
|
18
|
-
|
|
19
|
-
## Controlled
|
|
20
|
-
|
|
21
|
-
You provide a fixed set of components. The agent chooses which component to render and supplies its data. This predictable, brand-safe approach works well for high-traffic surfaces. The Controlled primitives use CopilotKit's v2 API, imported from `@copilotkit/react-core/v2`.
|
|
22
|
-
|
|
23
|
-
### Tool call rendering
|
|
24
|
-
|
|
25
|
-
Render an agent's tool call as a React component. Define the agent and tool on the Mastra server as usual:
|
|
26
|
-
|
|
27
|
-
```typescript
|
|
28
|
-
import { Agent } from '@mastra/core/agent'
|
|
29
|
-
import { weatherTool } from '../tools/weather-tool'
|
|
30
|
-
|
|
31
|
-
export const weatherAgent = new Agent({
|
|
32
|
-
id: 'weather-agent',
|
|
33
|
-
name: 'Weather Agent',
|
|
34
|
-
instructions: 'Use the weatherTool to fetch current weather data.',
|
|
35
|
-
model: 'openai/gpt-5.6-sol',
|
|
36
|
-
tools: { weatherTool },
|
|
37
|
-
})
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
On the frontend, register a renderer for the tool by name with `useRenderTool`. It's render-only (it doesn't execute the tool); the `render` function receives the tool call's `status` and, once the agent returns, its `result`:
|
|
41
|
-
|
|
42
|
-
```tsx
|
|
43
|
-
import { z } from 'zod'
|
|
44
|
-
import { CopilotChat } from '@copilotkit/react-ui'
|
|
45
|
-
import { CopilotKit, useRenderTool } from '@copilotkit/react-core/v2'
|
|
46
|
-
import { Weather } from '@/components/weather'
|
|
47
|
-
|
|
48
|
-
function Chat() {
|
|
49
|
-
useRenderTool(
|
|
50
|
-
{
|
|
51
|
-
name: 'weatherTool',
|
|
52
|
-
parameters: z.object({ location: z.string() }),
|
|
53
|
-
render: ({ status, result }) => {
|
|
54
|
-
if (status !== 'complete') {
|
|
55
|
-
return <div>Retrieving weather...</div>
|
|
56
|
-
}
|
|
57
|
-
return <Weather {...result} />
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
[],
|
|
61
|
-
)
|
|
62
|
-
|
|
63
|
-
return <CopilotChat labels={{ title: 'Weather Assistant' }} />
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export default function Page() {
|
|
67
|
-
return (
|
|
68
|
-
<CopilotKit runtimeUrl="http://localhost:4111/copilotkit" agent="weatherAgent">
|
|
69
|
-
<Chat />
|
|
70
|
-
</CopilotKit>
|
|
71
|
-
)
|
|
72
|
-
}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Because Mastra streams tool-call arguments incrementally, the `render` function is called repeatedly as the arguments arrive, so the UI can paint progressively while the agent works.
|
|
76
|
-
|
|
77
|
-
### Components as tools
|
|
78
|
-
|
|
79
|
-
Register a React component and let the agent call it as a tool. CopilotKit renders it inline with typed props (defined with a Zod schema):
|
|
80
|
-
|
|
81
|
-
```tsx
|
|
82
|
-
import { z } from 'zod'
|
|
83
|
-
import { useComponent } from '@copilotkit/react-core/v2'
|
|
84
|
-
|
|
85
|
-
const schema = z.object({ text: z.string() })
|
|
86
|
-
|
|
87
|
-
function Callout({ text }: z.infer<typeof schema>) {
|
|
88
|
-
return <div className="callout">{text}</div>
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function Chat() {
|
|
92
|
-
useComponent({ name: 'callout', render: Callout, parameters: schema }, [])
|
|
93
|
-
return <CopilotChat labels={{ title: 'Assistant' }} />
|
|
94
|
-
}
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
The agent invokes `callout` like any other tool, and CopilotKit renders `Callout` with the props it passed.
|
|
98
|
-
|
|
99
|
-
### State rendering
|
|
100
|
-
|
|
101
|
-
Render UI from the agent's state and re-render as it streams. On Mastra, agent state is the agent's working memory, streamed to the client as it changes. Read it with `useAgent`; `agent.state` is reactive, so the component updates automatically:
|
|
102
|
-
|
|
103
|
-
```tsx
|
|
104
|
-
import { useAgent } from '@copilotkit/react-core/v2'
|
|
105
|
-
|
|
106
|
-
function TaskBoard() {
|
|
107
|
-
const { agent } = useAgent()
|
|
108
|
-
const tasks = (agent.state.tasks as any[]) ?? []
|
|
109
|
-
|
|
110
|
-
return (
|
|
111
|
-
<ul>
|
|
112
|
-
{tasks.map((task, i) => (
|
|
113
|
-
<li key={i}>
|
|
114
|
-
{task.title}: {task.status}
|
|
115
|
-
</li>
|
|
116
|
-
))}
|
|
117
|
-
</ul>
|
|
118
|
-
)
|
|
119
|
-
}
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
### Reasoning
|
|
123
|
-
|
|
124
|
-
Reasoning is zero-config: when your Mastra agent runs a reasoning-capable model, `CopilotChat` renders the model's thinking inline as a dedicated message type, with no extra code. To restyle it, pass your own component to the `reasoningMessage` slot on `CopilotChat`. See CopilotKit's [generative UI guides](https://docs.copilotkit.ai/) for details.
|
|
125
|
-
|
|
126
|
-
## Declarative
|
|
127
|
-
|
|
128
|
-
Instead of a fixed component per tool, you register a catalog of typed building blocks and the agent assembles them into a UI tree per request. CopilotKit calls this **A2UI** (Agent-to-UI), which has fixed-schema and flexible variants. It suits the long tail of secondary interactions where breadth matters more than pixel-perfection.
|
|
129
|
-
|
|
130
|
-
The path of least resistance is to pass your catalog to the `<CopilotKit>` provider. That single prop enables A2UI rendering and injects the A2UI tool into your agent, so no backend change is needed:
|
|
131
|
-
|
|
132
|
-
```tsx
|
|
133
|
-
import { CopilotKit } from '@copilotkit/react-core/v2'
|
|
134
|
-
import { myCatalog } from './a2ui-catalog'
|
|
135
|
-
|
|
136
|
-
export default function Page() {
|
|
137
|
-
return (
|
|
138
|
-
<CopilotKit
|
|
139
|
-
runtimeUrl="http://localhost:4111/copilotkit"
|
|
140
|
-
agent="weatherAgent"
|
|
141
|
-
a2ui={{ catalog: myCatalog }}
|
|
142
|
-
>
|
|
143
|
-
{/* your app */}
|
|
144
|
-
</CopilotKit>
|
|
145
|
-
)
|
|
146
|
-
}
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
The catalog defines the primitives (their schemas) and the renderers (how each primitive displays). In the fixed-schema variant, the components are pre-authored and the agent's tool only supplies data. The flexible variant lets the agent compose the tree more freely. See CopilotKit's [A2UI documentation](https://docs.copilotkit.ai/a2a/generative-ui/a2ui).
|
|
150
|
-
|
|
151
|
-
## Open-ended
|
|
152
|
-
|
|
153
|
-
At the far end of the spectrum, the agent owns the entire surface: the UI is invented elsewhere and sandboxed in your app. CopilotKit supports this through **MCP Apps**, where an MCP server provides UI that renders inside your application. This tier trades determinism for novelty and is the most experimental point on the spectrum.
|
|
154
|
-
|
|
155
|
-
The path of least resistance keeps the frontend untouched: your existing `<CopilotKit>` provider is enough. On the backend, point `registerCopilotKit()` at one or more MCP servers with the `mcpApps` option (it's forwarded to the CopilotKit runtime):
|
|
156
|
-
|
|
157
|
-
```typescript
|
|
158
|
-
registerCopilotKit({
|
|
159
|
-
path: '/copilotkit',
|
|
160
|
-
resourceId: 'weatherAgent',
|
|
161
|
-
mcpApps: {
|
|
162
|
-
servers: [{ type: 'http', url: 'http://localhost:3108/mcp', serverId: 'my-server' }],
|
|
163
|
-
},
|
|
164
|
-
})
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
When the agent calls an MCP App tool, CopilotKit fetches and renders that tool's UI in the chat with no additional frontend code. See CopilotKit's [MCP Apps documentation](https://docs.copilotkit.ai/agno/generative-ui/mcp-apps).
|
|
168
|
-
|
|
169
|
-
## App control and interactivity
|
|
170
|
-
|
|
171
|
-
Some capabilities sit next to the spectrum rather than on it: they control your app or gate a run instead of rendering agent output. Both are covered in [Get started](https://mastra.ai/guides/build-your-ui/copilotkit/overview):
|
|
172
|
-
|
|
173
|
-
- **Frontend tools** (`useFrontendTool`): let the agent act on your application. This is part of CopilotKit's separate [App Control](https://docs.copilotkit.ai/) concept, alongside shared state and agent context.
|
|
174
|
-
- **Human-in-the-loop**: pause a run and wait for user approval or edits. Backend side, see Mastra's [Agent approval](https://mastra.ai/docs/agents/agent-approval); frontend side, see CopilotKit's [`useHumanInTheLoop`](https://docs.copilotkit.ai/reference/hooks/useHumanInTheLoop).
|