@mastra/client-js 1.0.1 → 1.1.0-alpha.0
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/CHANGELOG.md +127 -0
- package/dist/client.d.ts +13 -2
- package/dist/client.d.ts.map +1 -1
- package/dist/docs/README.md +1 -1
- package/dist/docs/SKILL.md +1 -1
- package/dist/docs/SOURCE_MAP.json +1 -1
- package/dist/docs/ai-sdk/01-reference.md +1 -1
- package/dist/docs/client-js/01-reference.md +3 -3
- package/dist/docs/server/01-mastra-client.md +17 -42
- package/dist/docs/server/02-jwt.md +5 -5
- package/dist/docs/server/03-clerk.md +4 -4
- package/dist/docs/server/04-supabase.md +4 -4
- package/dist/docs/server/05-firebase.md +5 -5
- package/dist/docs/server/06-workos.md +4 -4
- package/dist/docs/server/07-auth0.md +4 -4
- package/dist/index.cjs +545 -154
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +545 -154
- package/dist/index.js.map +1 -1
- package/dist/resources/agent-builder.d.ts +13 -13
- package/dist/resources/base.d.ts +13 -1
- package/dist/resources/base.d.ts.map +1 -1
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.d.ts.map +1 -1
- package/dist/resources/mcp-tool.d.ts.map +1 -1
- package/dist/resources/run.d.ts.map +1 -1
- package/dist/resources/stored-agent.d.ts +58 -4
- package/dist/resources/stored-agent.d.ts.map +1 -1
- package/dist/resources/vector.d.ts.map +1 -1
- package/dist/resources/workspace.d.ts +125 -0
- package/dist/resources/workspace.d.ts.map +1 -0
- package/dist/types.d.ts +317 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,132 @@
|
|
|
1
1
|
# @mastra/client-js
|
|
2
2
|
|
|
3
|
+
## 1.1.0-alpha.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added workspace client methods for interacting with workspace API endpoints. ([#11986](https://github.com/mastra-ai/mastra/pull/11986))
|
|
8
|
+
|
|
9
|
+
**New methods on `MastraClient`:**
|
|
10
|
+
- `listWorkspaces()` - List all available workspaces
|
|
11
|
+
- `getWorkspace(workspaceId)` - Get a workspace client for a specific workspace
|
|
12
|
+
- `workspace.info()` - Get workspace info and capabilities
|
|
13
|
+
- `workspace.listFiles()` / `readFile()` / `writeFile()` / `delete()` / `mkdir()` / `stat()` - Filesystem operations
|
|
14
|
+
- `workspace.listSkills()` / `getSkill(name).details()` / `.listReferences()` / `.getReference()` - Skill management
|
|
15
|
+
- `workspace.search()` - Search indexed content
|
|
16
|
+
|
|
17
|
+
**Usage:**
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { MastraClient } from '@mastra/client-js';
|
|
21
|
+
|
|
22
|
+
const client = new MastraClient({ baseUrl: 'http://localhost:4111' });
|
|
23
|
+
|
|
24
|
+
// List workspaces and get the first one
|
|
25
|
+
const { workspaces } = await client.listWorkspaces();
|
|
26
|
+
const workspace = client.getWorkspace(workspaces[0].id);
|
|
27
|
+
|
|
28
|
+
// Read a file
|
|
29
|
+
const { content } = await workspace.readFile('/docs/guide.md');
|
|
30
|
+
|
|
31
|
+
// List skills
|
|
32
|
+
const { skills } = await workspace.listSkills();
|
|
33
|
+
|
|
34
|
+
// Get skill details
|
|
35
|
+
const skill = workspace.getSkill('my-skill');
|
|
36
|
+
const details = await skill.details();
|
|
37
|
+
|
|
38
|
+
// Search content
|
|
39
|
+
const { results } = await workspace.search({ query: 'authentication', mode: 'hybrid' });
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- Added dynamic agent management with CRUD operations and version tracking ([#12038](https://github.com/mastra-ai/mastra/pull/12038))
|
|
43
|
+
|
|
44
|
+
**New Features:**
|
|
45
|
+
- Create, edit, and delete agents directly from the Mastra Studio UI
|
|
46
|
+
- Full version history for agents with compare and restore capabilities
|
|
47
|
+
- Visual diff viewer to compare agent configurations across versions
|
|
48
|
+
- Agent creation modal with comprehensive configuration options (model selection, instructions, tools, workflows, sub-agents, memory)
|
|
49
|
+
- AI-powered instruction enhancement
|
|
50
|
+
|
|
51
|
+
**Storage:**
|
|
52
|
+
- New storage interfaces for stored agents and agent versions
|
|
53
|
+
- PostgreSQL, LibSQL, and MongoDB implementations included
|
|
54
|
+
- In-memory storage for development and testing
|
|
55
|
+
|
|
56
|
+
**API:**
|
|
57
|
+
- RESTful endpoints for agent CRUD operations
|
|
58
|
+
- Version management endpoints (create, list, activate, restore, delete, compare)
|
|
59
|
+
- Automatic versioning on agent updates when enabled
|
|
60
|
+
|
|
61
|
+
**Client SDK:**
|
|
62
|
+
- JavaScript client with full support for stored agents and versions
|
|
63
|
+
- Type-safe methods for all CRUD and version operations
|
|
64
|
+
|
|
65
|
+
**Usage Example:**
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
// Server-side: Configure storage
|
|
69
|
+
import { Mastra } from '@mastra/core';
|
|
70
|
+
import { PgAgentsStorage } from '@mastra/pg';
|
|
71
|
+
|
|
72
|
+
const mastra = new Mastra({
|
|
73
|
+
agents: { agentOne },
|
|
74
|
+
storage: {
|
|
75
|
+
agents: new PgAgentsStorage({
|
|
76
|
+
connectionString: process.env.DATABASE_URL,
|
|
77
|
+
}),
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
// Client-side: Use the SDK
|
|
82
|
+
import { MastraClient } from '@mastra/client-js';
|
|
83
|
+
|
|
84
|
+
const client = new MastraClient({ baseUrl: 'http://localhost:3000' });
|
|
85
|
+
|
|
86
|
+
// Create a stored agent
|
|
87
|
+
const agent = await client.createStoredAgent({
|
|
88
|
+
name: 'Customer Support Agent',
|
|
89
|
+
description: 'Handles customer inquiries',
|
|
90
|
+
model: { provider: 'ANTHROPIC', name: 'claude-sonnet-4-5' },
|
|
91
|
+
instructions: 'You are a helpful customer support agent...',
|
|
92
|
+
tools: ['search', 'email'],
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
// Create a version snapshot
|
|
96
|
+
await client.storedAgent(agent.id).createVersion({
|
|
97
|
+
name: 'v1.0 - Initial release',
|
|
98
|
+
changeMessage: 'First production version',
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Compare versions
|
|
102
|
+
const diff = await client.storedAgent(agent.id).compareVersions('version-1', 'version-2');
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**Why:**
|
|
106
|
+
This feature enables teams to manage agents dynamically without code changes, making it easier to iterate on agent configurations and maintain a complete audit trail of changes.
|
|
107
|
+
|
|
108
|
+
- Added `apiPrefix` option to `MastraClient` for connecting to servers with custom API route prefixes. ([#12295](https://github.com/mastra-ai/mastra/pull/12295))
|
|
109
|
+
|
|
110
|
+
**Before:** The client always used the `/api` prefix for all endpoints.
|
|
111
|
+
|
|
112
|
+
**After:** You can now specify a custom prefix when deploying Mastra behind non-default paths:
|
|
113
|
+
|
|
114
|
+
```typescript
|
|
115
|
+
const client = new MastraClient({
|
|
116
|
+
baseUrl: 'http://localhost:3000',
|
|
117
|
+
apiPrefix: '/mastra', // Calls /mastra/agents, /mastra/workflows, etc.
|
|
118
|
+
});
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The default remains `/api` for backward compatibility. See #12261 for more details.
|
|
122
|
+
|
|
123
|
+
### Patch Changes
|
|
124
|
+
|
|
125
|
+
- Added requestContextSchema type support. ([#12259](https://github.com/mastra-ai/mastra/pull/12259))
|
|
126
|
+
|
|
127
|
+
- Updated dependencies [[`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`1cf5d2e`](https://github.com/mastra-ai/mastra/commit/1cf5d2ea1b085be23e34fb506c80c80a4e6d9c2b), [`833ae96`](https://github.com/mastra-ai/mastra/commit/833ae96c3e34370e58a1e979571c41f39a720592), [`943772b`](https://github.com/mastra-ai/mastra/commit/943772b4378f625f0f4e19ea2b7c392bd8e71786), [`b5c711b`](https://github.com/mastra-ai/mastra/commit/b5c711b281dd1fb81a399a766bc9f86c55efc13e), [`3efbe5a`](https://github.com/mastra-ai/mastra/commit/3efbe5ae20864c4f3143457f4f3ee7dc2fa5ca76), [`1e49e7a`](https://github.com/mastra-ai/mastra/commit/1e49e7ab5f173582154cb26b29d424de67d09aef), [`751eaab`](https://github.com/mastra-ai/mastra/commit/751eaab4e0d3820a94e4c3d39a2ff2663ded3d91), [`69d8156`](https://github.com/mastra-ai/mastra/commit/69d81568bcf062557c24471ce26812446bec465d), [`60d9d89`](https://github.com/mastra-ai/mastra/commit/60d9d899e44b35bc43f1bcd967a74e0ce010b1af), [`5c544c8`](https://github.com/mastra-ai/mastra/commit/5c544c8d12b08ab40d64d8f37b3c4215bee95b87), [`771ad96`](https://github.com/mastra-ai/mastra/commit/771ad962441996b5c43549391a3e6a02c6ddedc2), [`2b0936b`](https://github.com/mastra-ai/mastra/commit/2b0936b0c9a43eeed9bef63e614d7e02ee803f7e), [`3b04f30`](https://github.com/mastra-ai/mastra/commit/3b04f3010604f3cdfc8a0674731700ad66471cee), [`97e26de`](https://github.com/mastra-ai/mastra/commit/97e26deaebd9836647a67b96423281d66421ca07), [`10523f4`](https://github.com/mastra-ai/mastra/commit/10523f4882d9b874b40ce6e3715f66dbcd4947d2), [`cb72d20`](https://github.com/mastra-ai/mastra/commit/cb72d2069d7339bda8a0e76d4f35615debb07b84), [`42856b1`](https://github.com/mastra-ai/mastra/commit/42856b1c8aeea6371c9ee77ae2f5f5fe34400933), [`66f33ff`](https://github.com/mastra-ai/mastra/commit/66f33ff68620018513e499c394411d1d39b3aa5c), [`ab3c190`](https://github.com/mastra-ai/mastra/commit/ab3c1901980a99910ca9b96a7090c22e24060113), [`d4f06c8`](https://github.com/mastra-ai/mastra/commit/d4f06c85ffa5bb0da38fb82ebf3b040cc6b4ec4e), [`0350626`](https://github.com/mastra-ai/mastra/commit/03506267ec41b67add80d994c0c0fcce93bbc75f), [`bc9fa00`](https://github.com/mastra-ai/mastra/commit/bc9fa00859c5c4a796d53a0a5cae46ab4a3072e4), [`f46a478`](https://github.com/mastra-ai/mastra/commit/f46a4782f595949c696569e891f81c8d26338508), [`90fc0e5`](https://github.com/mastra-ai/mastra/commit/90fc0e5717cb280c2d4acf4f0410b510bb4c0a72), [`f05a3a5`](https://github.com/mastra-ai/mastra/commit/f05a3a5cf2b9a9c2d40c09cb8c762a4b6cd5d565), [`a291da9`](https://github.com/mastra-ai/mastra/commit/a291da9363efd92dafd8775dccb4f2d0511ece7a), [`c5d71da`](https://github.com/mastra-ai/mastra/commit/c5d71da1c680ce5640b1a7f8ca0e024a4ab1cfed), [`07042f9`](https://github.com/mastra-ai/mastra/commit/07042f9f89080f38b8f72713ba1c972d5b1905b8), [`0423442`](https://github.com/mastra-ai/mastra/commit/0423442b7be2dfacba95890bea8f4a810db4d603)]:
|
|
128
|
+
- @mastra/core@1.1.0-alpha.0
|
|
129
|
+
|
|
3
130
|
## 1.0.1
|
|
4
131
|
|
|
5
132
|
### Patch Changes
|
package/dist/client.d.ts
CHANGED
|
@@ -3,9 +3,9 @@ import type { ServerDetailInfo } from '@mastra/core/mcp';
|
|
|
3
3
|
import type { RequestContext } from '@mastra/core/request-context';
|
|
4
4
|
import type { TraceRecord, ListTracesArgs, ListTracesResponse } from '@mastra/core/storage';
|
|
5
5
|
import type { WorkflowInfo } from '@mastra/core/workflows';
|
|
6
|
-
import { Agent, MemoryThread, Tool, Processor, Workflow, Vector, BaseResource, A2A, MCPTool, AgentBuilder, StoredAgent } from './resources/index.js';
|
|
6
|
+
import { Agent, MemoryThread, Tool, Processor, Workflow, Vector, BaseResource, A2A, MCPTool, AgentBuilder, StoredAgent, Workspace } from './resources/index.js';
|
|
7
7
|
import type { ListScoresBySpanParams, LegacyTracesPaginatedArg, LegacyGetTracesResponse } from './resources/observability.js';
|
|
8
|
-
import type { ClientOptions, CreateMemoryThreadParams, CreateMemoryThreadResponse, GetAgentResponse, GetLogParams, GetLogsParams, GetLogsResponse, GetToolResponse, GetProcessorResponse, GetWorkflowResponse, SaveMessageToMemoryParams, SaveMessageToMemoryResponse, McpServerListResponse, McpServerToolListResponse, GetScorerResponse, ListScoresByScorerIdParams, ListScoresByRunIdParams, ListScoresByEntityIdParams, SaveScoreParams, SaveScoreResponse, GetMemoryConfigParams, GetMemoryConfigResponse, ListMemoryThreadMessagesResponse, MemorySearchResponse, ListAgentsModelProvidersResponse, ListMemoryThreadsParams, ListMemoryThreadsResponse, ListStoredAgentsParams, ListStoredAgentsResponse, CreateStoredAgentParams, StoredAgentResponse, GetSystemPackagesResponse, ListScoresResponse as ListScoresResponseOld } from './types.js';
|
|
8
|
+
import type { ClientOptions, CreateMemoryThreadParams, CreateMemoryThreadResponse, GetAgentResponse, GetLogParams, GetLogsParams, GetLogsResponse, GetToolResponse, GetProcessorResponse, GetWorkflowResponse, SaveMessageToMemoryParams, SaveMessageToMemoryResponse, McpServerListResponse, McpServerToolListResponse, GetScorerResponse, ListScoresByScorerIdParams, ListScoresByRunIdParams, ListScoresByEntityIdParams, SaveScoreParams, SaveScoreResponse, GetMemoryConfigParams, GetMemoryConfigResponse, ListMemoryThreadMessagesResponse, MemorySearchResponse, ListAgentsModelProvidersResponse, ListMemoryThreadsParams, ListMemoryThreadsResponse, ListStoredAgentsParams, ListStoredAgentsResponse, CreateStoredAgentParams, StoredAgentResponse, GetSystemPackagesResponse, ListScoresResponse as ListScoresResponseOld, ListWorkspacesResponse } from './types.js';
|
|
9
9
|
export declare class MastraClient extends BaseResource {
|
|
10
10
|
private observability;
|
|
11
11
|
constructor(options: ClientOptions);
|
|
@@ -317,5 +317,16 @@ export declare class MastraClient extends BaseResource {
|
|
|
317
317
|
* @returns Promise containing the list of installed Mastra packages
|
|
318
318
|
*/
|
|
319
319
|
getSystemPackages(): Promise<GetSystemPackagesResponse>;
|
|
320
|
+
/**
|
|
321
|
+
* Lists all workspaces from both Mastra instance and agents
|
|
322
|
+
* @returns Promise containing array of workspace items
|
|
323
|
+
*/
|
|
324
|
+
listWorkspaces(): Promise<ListWorkspacesResponse>;
|
|
325
|
+
/**
|
|
326
|
+
* Gets the workspace resource for filesystem, search, and skills operations
|
|
327
|
+
* @param workspaceId - Workspace ID to target
|
|
328
|
+
* @returns Workspace instance
|
|
329
|
+
*/
|
|
330
|
+
getWorkspace(workspaceId: string): Workspace;
|
|
320
331
|
}
|
|
321
332
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,KAAK,EACL,YAAY,EACZ,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,GAAG,EACH,OAAO,EACP,YAAY,EAEZ,WAAW,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC5F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAw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E,MAAM,CAAA;SAAE,CAAC,CAAC;KACtD,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAQhD;;;;OAIG;IACI,gBAAgB,CAAC,MAAM,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAsB3F;;;;OAIG;IACI,iBAAiB,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAOvF;;;;OAIG;IACI,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,WAAW;IAQzD;;;OAGG;IACI,iBAAiB,IAAI,OAAO,CAAC,yBAAyB,CAAC;IAQ9D;;;OAGG;IACI,cAAc,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAIxD;;;;OAIG;IACI,YAAY,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS;CAGpD"}
|
package/dist/docs/README.md
CHANGED
package/dist/docs/SKILL.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
Converts Mastra streams (agent, network, or workflow) to AI SDK-compatible streams. Use this function when you need to manually transform Mastra streams for use with AI SDK's `createUIMessageStream()` and `createUIMessageStreamResponse()`.
|
|
13
13
|
|
|
14
|
-
This is useful when building custom streaming endpoints outside Mastra's provided route helpers such as [`chatRoute()`](https://mastra.ai/reference/
|
|
14
|
+
This is useful when building custom streaming endpoints outside Mastra's provided route helpers such as [`chatRoute()`](https://mastra.ai/reference/ai-sdk/chat-route) or [`workflowRoute()`](https://mastra.ai/reference/ai-sdk/workflow-route).
|
|
15
15
|
|
|
16
16
|
## Usage example
|
|
17
17
|
|
|
@@ -502,7 +502,7 @@ const runLogs = await mastraClient.getLogForRun({
|
|
|
502
502
|
|
|
503
503
|
> Learn how to interact with Mastra using the client-js SDK.
|
|
504
504
|
|
|
505
|
-
The Mastra Client SDK provides a simple and type-safe interface for interacting with your [Mastra Server](https://mastra.ai/docs/
|
|
505
|
+
The Mastra Client SDK provides a simple and type-safe interface for interacting with your [Mastra Server](https://mastra.ai/docs/deployment/mastra-server) from your client environment.
|
|
506
506
|
|
|
507
507
|
## Usage example
|
|
508
508
|
|
|
@@ -1068,7 +1068,7 @@ const result = await run.startAsync({
|
|
|
1068
1068
|
});
|
|
1069
1069
|
```
|
|
1070
1070
|
|
|
1071
|
-
The `initialState` object should match the structure defined in the workflow's `stateSchema`. See [Workflow State](https://mastra.ai/docs/
|
|
1071
|
+
The `initialState` object should match the structure defined in the workflow's `stateSchema`. See [Workflow State](https://mastra.ai/docs/workflows/workflow-state) for more details.
|
|
1072
1072
|
|
|
1073
1073
|
To associate a run with a specific resource, pass `resourceId` to `createRun()`:
|
|
1074
1074
|
|
|
@@ -1140,7 +1140,7 @@ const result = await run.cancel();
|
|
|
1140
1140
|
|
|
1141
1141
|
This method stops any running steps and prevents subsequent steps from executing. Steps that check the `abortSignal` parameter can respond to cancellation by cleaning up resources (timeouts, network requests, etc.).
|
|
1142
1142
|
|
|
1143
|
-
See the [Run.cancel()](https://mastra.ai/reference/
|
|
1143
|
+
See the [Run.cancel()](https://mastra.ai/reference/workflows/run-methods/cancel) reference for detailed information about how cancellation works and how to write steps that respond to cancellation.
|
|
1144
1144
|
|
|
1145
1145
|
### stream()
|
|
1146
1146
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Mastra Client SDK
|
|
4
4
|
|
|
5
|
-
The Mastra Client SDK provides a simple and type-safe interface for interacting with your [Mastra Server](https://mastra.ai/docs/
|
|
5
|
+
The Mastra Client SDK provides a simple and type-safe interface for interacting with your [Mastra Server](https://mastra.ai/docs/server/mastra-server) from your client environment.
|
|
6
6
|
|
|
7
7
|
## Prerequisites
|
|
8
8
|
|
|
@@ -20,34 +20,9 @@ The Mastra Client SDK is designed for browser environments and uses the native `
|
|
|
20
20
|
|
|
21
21
|
To use the Mastra Client SDK, install the required dependencies:
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
npm install @mastra/client-js@beta
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
**pnpm:**
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
pnpm add @mastra/client-js@beta
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
**yarn:**
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
yarn add @mastra/client-js@beta
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
**bun:**
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
bun add @mastra/client-js@beta
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
|
|
23
|
+
```bash npm2yarn
|
|
24
|
+
npm install @mastra/client-js@latest
|
|
25
|
+
```
|
|
51
26
|
|
|
52
27
|
### Initialize the `MastraClient`
|
|
53
28
|
|
|
@@ -65,13 +40,13 @@ export const mastraClient = new MastraClient({
|
|
|
65
40
|
|
|
66
41
|
The Mastra Client SDK exposes all resources served by the Mastra Server
|
|
67
42
|
|
|
68
|
-
- **[Agents](https://mastra.ai/reference/
|
|
69
|
-
- **[Memory](https://mastra.ai/reference/
|
|
70
|
-
- **[Tools](https://mastra.ai/reference/
|
|
71
|
-
- **[Workflows](https://mastra.ai/reference/
|
|
72
|
-
- **[Vectors](https://mastra.ai/reference/
|
|
73
|
-
- **[Logs](https://mastra.ai/reference/
|
|
74
|
-
- **[Telemetry](https://mastra.ai/reference/
|
|
43
|
+
- **[Agents](https://mastra.ai/reference/client-js/agents)**: Generate responses and stream conversations.
|
|
44
|
+
- **[Memory](https://mastra.ai/reference/client-js/memory)**: Manage conversation threads and message history.
|
|
45
|
+
- **[Tools](https://mastra.ai/reference/client-js/tools)**: Executed and managed tools.
|
|
46
|
+
- **[Workflows](https://mastra.ai/reference/client-js/workflows)**: Trigger workflows and track their execution.
|
|
47
|
+
- **[Vectors](https://mastra.ai/reference/client-js/vectors)**: Use vector embeddings for semantic search.
|
|
48
|
+
- **[Logs](https://mastra.ai/reference/client-js/logs)**: View logs and debug system behavior.
|
|
49
|
+
- **[Telemetry](https://mastra.ai/reference/client-js/telemetry)**: Monitor app performance and trace activity.
|
|
75
50
|
|
|
76
51
|
## Generating responses
|
|
77
52
|
|
|
@@ -95,7 +70,7 @@ const testAgent = async () => {
|
|
|
95
70
|
|
|
96
71
|
> **Note:**
|
|
97
72
|
|
|
98
|
-
You can also call `.generate()` with an array of message objects that include `role` and `content`. Visit the [.generate() reference](https://mastra.ai/reference/
|
|
73
|
+
You can also call `.generate()` with an array of message objects that include `role` and `content`. Visit the [.generate() reference](https://mastra.ai/reference/client-js/agents#generate) for more information.
|
|
99
74
|
|
|
100
75
|
## Streaming responses
|
|
101
76
|
|
|
@@ -123,7 +98,7 @@ const testAgent = async () => {
|
|
|
123
98
|
|
|
124
99
|
> **Note:**
|
|
125
100
|
|
|
126
|
-
You can also call `.stream()` with an array of message objects that include `role` and `content`. Visit the [.stream() reference](https://mastra.ai/reference/
|
|
101
|
+
You can also call `.stream()` with an array of message objects that include `role` and `content`. Visit the [.stream() reference](https://mastra.ai/reference/client-js/agents#stream) for more information.
|
|
127
102
|
|
|
128
103
|
## Configuration options
|
|
129
104
|
|
|
@@ -144,7 +119,7 @@ export const mastraClient = new MastraClient({
|
|
|
144
119
|
|
|
145
120
|
> **Note:**
|
|
146
121
|
|
|
147
|
-
Visit [MastraClient](https://mastra.ai/reference/
|
|
122
|
+
Visit [MastraClient](https://mastra.ai/reference/client-js/mastra-client) for more configuration options.
|
|
148
123
|
|
|
149
124
|
## Adding request cancelling
|
|
150
125
|
|
|
@@ -250,7 +225,7 @@ export async function action() {
|
|
|
250
225
|
|
|
251
226
|
## Best practices
|
|
252
227
|
|
|
253
|
-
1. **Error Handling**: Implement proper [error handling](https://mastra.ai/reference/
|
|
228
|
+
1. **Error Handling**: Implement proper [error handling](https://mastra.ai/reference/client-js/error-handling) for development scenarios.
|
|
254
229
|
2. **Environment Variables**: Use environment variables for configuration.
|
|
255
|
-
3. **Debugging**: Enable detailed [logging](https://mastra.ai/reference/
|
|
256
|
-
4. **Performance**: Monitor application performance, [telemetry](https://mastra.ai/reference/
|
|
230
|
+
3. **Debugging**: Enable detailed [logging](https://mastra.ai/reference/client-js/logs) when needed.
|
|
231
|
+
4. **Performance**: Monitor application performance, [telemetry](https://mastra.ai/reference/client-js/telemetry) and traces.
|
|
@@ -8,8 +8,8 @@ The `MastraJwtAuth` class provides a lightweight authentication mechanism for Ma
|
|
|
8
8
|
|
|
9
9
|
Before you can use the `MastraJwtAuth` class you have to install the `@mastra/auth` package.
|
|
10
10
|
|
|
11
|
-
```bash
|
|
12
|
-
npm install @mastra/auth@
|
|
11
|
+
```bash npm2yarn
|
|
12
|
+
npm install @mastra/auth@latest
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
## Usage example
|
|
@@ -29,7 +29,7 @@ export const mastra = new Mastra({
|
|
|
29
29
|
|
|
30
30
|
> **Note:**
|
|
31
31
|
|
|
32
|
-
Visit [MastraJwtAuth](https://mastra.ai/reference/
|
|
32
|
+
Visit [MastraJwtAuth](https://mastra.ai/reference/auth/jwt) for all available configuration options.
|
|
33
33
|
|
|
34
34
|
## Configuring `MastraClient`
|
|
35
35
|
|
|
@@ -48,7 +48,7 @@ export const mastraClient = new MastraClient({
|
|
|
48
48
|
|
|
49
49
|
> **Note:**
|
|
50
50
|
|
|
51
|
-
Visit [Mastra Client SDK](https://mastra.ai/docs/
|
|
51
|
+
Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
52
52
|
|
|
53
53
|
### Making authenticated requests
|
|
54
54
|
|
|
@@ -56,7 +56,7 @@ Once `MastraClient` is configured, you can send authenticated requests from your
|
|
|
56
56
|
|
|
57
57
|
**react:**
|
|
58
58
|
|
|
59
|
-
```tsx title="src/components/test-agent.tsx"
|
|
59
|
+
```tsx title="src/components/test-agent.tsx"
|
|
60
60
|
import { mastraClient } from "../../lib/mastra-client";
|
|
61
61
|
|
|
62
62
|
export const TestAgent = () => {
|
|
@@ -23,7 +23,7 @@ You can find these keys in your Clerk Dashboard under "API Keys".
|
|
|
23
23
|
Before you can use the `MastraAuthClerk` class you have to install the `@mastra/auth-clerk` package.
|
|
24
24
|
|
|
25
25
|
```bash
|
|
26
|
-
npm install @mastra/auth-clerk@
|
|
26
|
+
npm install @mastra/auth-clerk@latest
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
## Usage example
|
|
@@ -47,7 +47,7 @@ export const mastra = new Mastra({
|
|
|
47
47
|
|
|
48
48
|
The default `authorizeUser` method allows all authenticated users. To customize user authorization, provide a custom `authorizeUser` function when constructing the provider.
|
|
49
49
|
|
|
50
|
-
Visit [MastraAuthClerk](https://mastra.ai/reference/
|
|
50
|
+
Visit [MastraAuthClerk](https://mastra.ai/reference/auth/clerk) for all available configuration options.
|
|
51
51
|
|
|
52
52
|
## Client-side setup
|
|
53
53
|
|
|
@@ -95,7 +95,7 @@ export const mastraClient = new MastraClient({
|
|
|
95
95
|
|
|
96
96
|
The access token must be prefixed with `Bearer` in the Authorization header.
|
|
97
97
|
|
|
98
|
-
Visit [Mastra Client SDK](https://mastra.ai/docs/
|
|
98
|
+
Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
99
99
|
|
|
100
100
|
### Making authenticated requests
|
|
101
101
|
|
|
@@ -103,7 +103,7 @@ Once `MastraClient` is configured with the Clerk access token, you can send auth
|
|
|
103
103
|
|
|
104
104
|
**react:**
|
|
105
105
|
|
|
106
|
-
```tsx title="src/components/test-agent.tsx"
|
|
106
|
+
```tsx title="src/components/test-agent.tsx"
|
|
107
107
|
"use client";
|
|
108
108
|
|
|
109
109
|
import { useAuth } from "@clerk/nextjs";
|
|
@@ -22,7 +22,7 @@ Review your Supabase Row Level Security (RLS) settings to ensure proper data acc
|
|
|
22
22
|
Before you can use the `MastraAuthSupabase` class you have to install the `@mastra/auth-supabase` package.
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install @mastra/auth-supabase@
|
|
25
|
+
npm install @mastra/auth-supabase@latest
|
|
26
26
|
```
|
|
27
27
|
|
|
28
28
|
## Usage example
|
|
@@ -45,7 +45,7 @@ export const mastra = new Mastra({
|
|
|
45
45
|
|
|
46
46
|
The default `authorizeUser` method checks the `isAdmin` column in the `users` table in the `public` schema. To customize user authorization, provide a custom `authorizeUser` function when constructing the provider.
|
|
47
47
|
|
|
48
|
-
Visit [MastraAuthSupabase](https://mastra.ai/reference/
|
|
48
|
+
Visit [MastraAuthSupabase](https://mastra.ai/reference/auth/supabase) for all available configuration options.
|
|
49
49
|
|
|
50
50
|
## Client-side setup
|
|
51
51
|
|
|
@@ -91,7 +91,7 @@ export const mastraClient = new MastraClient({
|
|
|
91
91
|
|
|
92
92
|
The access token must be prefixed with `Bearer` in the Authorization header.
|
|
93
93
|
|
|
94
|
-
Visit [Mastra Client SDK](https://mastra.ai/docs/
|
|
94
|
+
Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
95
95
|
|
|
96
96
|
### Making authenticated requests
|
|
97
97
|
|
|
@@ -99,7 +99,7 @@ Once `MastraClient` is configured with the Supabase access token, you can send a
|
|
|
99
99
|
|
|
100
100
|
**react:**
|
|
101
101
|
|
|
102
|
-
```tsx title="src/components/test-agent.tsx"
|
|
102
|
+
```tsx title="src/components/test-agent.tsx"
|
|
103
103
|
import { mastraClient } from "../../lib/mastra-client";
|
|
104
104
|
|
|
105
105
|
export const TestAgent = () => {
|
|
@@ -29,7 +29,7 @@ Store your service account JSON file securely and never commit it to version con
|
|
|
29
29
|
Before you can use the `MastraAuthFirebase` class you have to install the `@mastra/auth-firebase` package.
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
npm install @mastra/auth-firebase@
|
|
32
|
+
npm install @mastra/auth-firebase@latest
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
## Usage examples
|
|
@@ -104,7 +104,7 @@ const firebaseAuth = new MastraAuthFirebase({
|
|
|
104
104
|
|
|
105
105
|
> **Note:**
|
|
106
106
|
|
|
107
|
-
Visit [MastraAuthFirebase](https://mastra.ai/reference/
|
|
107
|
+
Visit [MastraAuthFirebase](https://mastra.ai/reference/auth/firebase) for all available configuration options.
|
|
108
108
|
|
|
109
109
|
## Client-side setup
|
|
110
110
|
|
|
@@ -192,7 +192,7 @@ export const createMastraClient = (idToken: string) => {
|
|
|
192
192
|
|
|
193
193
|
The ID token must be prefixed with `Bearer` in the Authorization header.
|
|
194
194
|
|
|
195
|
-
Visit [Mastra Client SDK](https://mastra.ai/docs/
|
|
195
|
+
Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
196
196
|
|
|
197
197
|
### Making authenticated requests
|
|
198
198
|
|
|
@@ -200,7 +200,7 @@ Once `MastraClient` is configured with the Firebase ID token, you can send authe
|
|
|
200
200
|
|
|
201
201
|
**react:**
|
|
202
202
|
|
|
203
|
-
```tsx title="src/components/test-agent.tsx"
|
|
203
|
+
```tsx title="src/components/test-agent.tsx"
|
|
204
204
|
"use client";
|
|
205
205
|
|
|
206
206
|
import { useAuthState } from 'react-firebase-hooks/auth';
|
|
@@ -234,7 +234,7 @@ Once `MastraClient` is configured with the Firebase ID token, you can send authe
|
|
|
234
234
|
|
|
235
235
|
**nodejs:**
|
|
236
236
|
|
|
237
|
-
```typescript title="server.js"
|
|
237
|
+
```typescript title="server.js"
|
|
238
238
|
const express = require('express');
|
|
239
239
|
const admin = require('firebase-admin');
|
|
240
240
|
const { MastraClient } = require('@mastra/client-js');
|
|
@@ -29,7 +29,7 @@ For detailed setup instructions, refer to the [WorkOS documentation](https://wor
|
|
|
29
29
|
Before you can use the `MastraAuthWorkos` class you have to install the `@mastra/auth-workos` package.
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
npm install @mastra/auth-workos@
|
|
32
|
+
npm install @mastra/auth-workos@latest
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
## Usage examples
|
|
@@ -90,7 +90,7 @@ const workosAuth = new MastraAuthWorkos({
|
|
|
90
90
|
|
|
91
91
|
> **Note:**
|
|
92
92
|
|
|
93
|
-
Visit [MastraAuthWorkos](https://mastra.ai/reference/
|
|
93
|
+
Visit [MastraAuthWorkos](https://mastra.ai/reference/auth/workos) for all available configuration options.
|
|
94
94
|
|
|
95
95
|
## Client-side setup
|
|
96
96
|
|
|
@@ -152,7 +152,7 @@ export const createMastraClient = (accessToken: string) => {
|
|
|
152
152
|
|
|
153
153
|
The access token must be prefixed with `Bearer` in the Authorization header.
|
|
154
154
|
|
|
155
|
-
Visit [Mastra Client SDK](https://mastra.ai/docs/
|
|
155
|
+
Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
156
156
|
|
|
157
157
|
### Making authenticated requests
|
|
158
158
|
|
|
@@ -160,7 +160,7 @@ Once `MastraClient` is configured with the WorkOS access token, you can send aut
|
|
|
160
160
|
|
|
161
161
|
**react:**
|
|
162
162
|
|
|
163
|
-
```typescript title="src/api/agents.ts"
|
|
163
|
+
```typescript title="src/api/agents.ts"
|
|
164
164
|
import { WorkOS } from '@workos-inc/node';
|
|
165
165
|
import { MastraClient } from '@mastra/client-js';
|
|
166
166
|
|
|
@@ -29,7 +29,7 @@ For detailed setup instructions, refer to the [Auth0 quickstarts](https://auth0.
|
|
|
29
29
|
Before you can use the `MastraAuthAuth0` class you have to install the `@mastra/auth-auth0` package.
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
npm install @mastra/auth-auth0@
|
|
32
|
+
npm install @mastra/auth-auth0@latest
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
## Usage examples
|
|
@@ -89,7 +89,7 @@ const auth0Provider = new MastraAuthAuth0({
|
|
|
89
89
|
|
|
90
90
|
> **Note:**
|
|
91
91
|
|
|
92
|
-
Visit [MastraAuthAuth0](https://mastra.ai/reference/
|
|
92
|
+
Visit [MastraAuthAuth0](https://mastra.ai/reference/auth/auth0) for all available configuration options.
|
|
93
93
|
|
|
94
94
|
## Client-side setup
|
|
95
95
|
|
|
@@ -170,7 +170,7 @@ export const createMastraClient = (accessToken: string) => {
|
|
|
170
170
|
|
|
171
171
|
The access token must be prefixed with `Bearer` in the Authorization header.
|
|
172
172
|
|
|
173
|
-
Visit [Mastra Client SDK](https://mastra.ai/docs/
|
|
173
|
+
Visit [Mastra Client SDK](https://mastra.ai/docs/server/mastra-client) for more configuration options.
|
|
174
174
|
|
|
175
175
|
### Making authenticated requests
|
|
176
176
|
|
|
@@ -178,7 +178,7 @@ Once `MastraClient` is configured with the Auth0 access token, you can send auth
|
|
|
178
178
|
|
|
179
179
|
**react:**
|
|
180
180
|
|
|
181
|
-
```tsx title="src/components/mastra-api-test.tsx"
|
|
181
|
+
```tsx title="src/components/mastra-api-test.tsx"
|
|
182
182
|
import React, { useState } from 'react';
|
|
183
183
|
import { useAuth0 } from '@auth0/auth0-react';
|
|
184
184
|
import { MastraClient } from '@mastra/client-js';
|