Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions typescript-sdk/apps/client-cli-example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"@ag-ui/core": "workspace:*",
"@ag-ui/mastra": "workspace:*",
"@ai-sdk/openai": "1.3.22",
"@mastra/client-js": "0.10.9",
"@mastra/core": "0.10.10",
"@mastra/libsql": "0.11.0",
"@mastra/loggers": "0.10.3",
"@mastra/memory": "0.11.1",
"@mastra/client-js": "0.10.18",
"@mastra/core": "0.12.1",
"@mastra/libsql": "0.12.0",
"@mastra/loggers": "0.10.5",
"@mastra/memory": "0.12.0",
"open": "^10.1.2",
"zod": "^3.22.4"
},
Expand Down
14 changes: 7 additions & 7 deletions typescript-sdk/apps/dojo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
"@copilotkit/runtime": "1.9.2",
"@copilotkit/runtime-client-gql": "1.9.2",
"@copilotkit/shared": "1.9.2",
"@mastra/client-js": "^0.10.9",
"@mastra/core": "^0.11.1",
"@mastra/dynamodb": "^0.13.2",
"@mastra/libsql": "^0.11.2",
"@mastra/loggers": "^0.10.3",
"@mastra/memory": "^0.11.5",
"@mastra/client-js": "^0.10.18",
"@mastra/core": "^0.12.1",
"@mastra/dynamodb": "^0.13.3",
"@mastra/libsql": "^0.12.0",
"@mastra/loggers": "^0.10.5",
"@mastra/memory": "^0.12.0",
"@mdx-js/loader": "^3.1.0",
"@mdx-js/mdx": "^3.1.0",
"@mdx-js/react": "^3.1.0",
Expand Down Expand Up @@ -91,4 +91,4 @@
"typescript": "^5",
"wait-port": "^1.1.0"
}
}
}
10 changes: 5 additions & 5 deletions typescript-sdk/integrations/mastra/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
"dependencies": {
"@ai-sdk/openai": "^1.3.22",
"@mastra/client-js": "^0.10.1",
"@mastra/core": "^0.10.1",
"@mastra/libsql": "^0.10.0",
"@mastra/loggers": "^0.10.0",
"@mastra/memory": "^0.10.1",
"@mastra/core": "^0.12.1",
"@mastra/libsql": "^0.12.0",
"@mastra/loggers": "^0.10.5",
"@mastra/memory": "^0.12.0",
"zod": "^3.25.48"
},
"devDependencies": {
"@types/node": "^22.15.29",
"mastra": "^0.10.1",
"mastra": "^0.10.18",
"typescript": "^5.8.3"
}
}
8 changes: 4 additions & 4 deletions typescript-sdk/integrations/mastra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@
"dependencies": {
"@ag-ui/client": "workspace:*",
"@ai-sdk/ui-utils": "^1.1.19",
"@mastra/client-js": "^0.10.9",
"@mastra/client-js": "^0.10.18",
"rxjs": "7.8.1"
},
"peerDependencies": {
"@copilotkit/runtime": "^1.8.13",
"@mastra/core": "^0.10.10 || ^0.11.1",
"@copilotkit/runtime": "^1.9.3",
"@mastra/core": "^0.11.1 || ^0.12.1",
"zod": "^3.25.67"
},
"devDependencies": {
"@mastra/core": "^0.11.1",
"@mastra/core": "^0.12.1",
"@types/jest": "^29.5.14",
"@types/node": "^20.11.19",
"jest": "^29.7.0",
Expand Down
23 changes: 9 additions & 14 deletions typescript-sdk/integrations/mastra/src/mastra.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,8 @@ export class MastraAgent extends AbstractAgent {
subscriber.next(runStartedEvent);

// Handle local agent memory management (from Mastra implementation)
if ("metrics" in this.agent) {
// @ts-ignore
const memory = this.agent.getMemory();
if (this.isLocalMastraAgent(this.agent)) {
const memory = await this.agent.getMemory();

if (memory && input.state && Object.keys(input.state || {}).length > 0) {
let thread: StorageThreadType | null = await memory.getThreadById({
Expand Down Expand Up @@ -163,14 +162,12 @@ export class MastraAgent extends AbstractAgent {
subscriber.error(error);
},
onRunFinished: async () => {
if ("metrics" in this.agent) {
if (this.isLocalMastraAgent(this.agent)) {
try {
// @ts-ignore
const memory = this.agent.getMemory();
const memory = await this.agent.getMemory();
if (memory) {
const workingMemory = await memory.getWorkingMemory({
threadId: input.threadId,
// @ts-ignore
memoryConfig: {
workingMemory: {
enabled: true,
Expand Down Expand Up @@ -219,6 +216,10 @@ export class MastraAgent extends AbstractAgent {
});
}

isLocalMastraAgent(agent: LocalMastraAgent | RemoteMastraAgent): agent is LocalMastraAgent {
return "getMemory" in agent;
}

/**
* Streams in process or remote mastra agent.
* @param input - The input for the mastra agent.
Expand Down Expand Up @@ -251,13 +252,7 @@ export class MastraAgent extends AbstractAgent {
const convertedMessages = convertAGUIMessagesToMastra(messages);
const runtimeContext = this.runtimeContext;

function isLocalMastraAgent(
agent: LocalMastraAgent | RemoteMastraAgent,
): agent is LocalMastraAgent {
return "metrics" in agent;
}

if (isLocalMastraAgent(this.agent)) {
if (this.isLocalMastraAgent(this.agent)) {
// Local agent - use the agent's stream method directly
try {
const response = await this.agent.stream(convertedMessages, {
Expand Down
Loading
Loading