Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions .github/workflows/dojo-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ jobs:
test_path: tests/serverStarterAllFeaturesTests
services: ["dojo","server-starter-all"]
wait_on: http://localhost:9999,tcp:localhost:8001
- suite: vercel-ai-sdk
test_path: tests/vercelAISdkTests
services: ["dojo"]
wait_on: http://localhost:9999
# - suite: vercel-ai-sdk
# test_path: tests/vercelAISdkTests
# services: ["dojo"]
# wait_on: http://localhost:9999

steps:
- name: Checkout code
Expand Down
3 changes: 3 additions & 0 deletions typescript-sdk/apps/dojo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,6 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

# mastra
.mastra
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ test("[MastraAgentLocal] Agentic Chat sends and receives a message", async ({

await waitForAIResponse(page);
await chat.assertUserMessageVisible("Hi, I am duaa");
await chat.assertAgentReplyVisible(/Hello/i);
await chat.assertAgentReplyVisible(/Hello|Hi/i);
});
});

Expand Down
19 changes: 10 additions & 9 deletions typescript-sdk/apps/dojo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,19 @@
"@ag-ui/server-starter": "workspace:*",
"@ag-ui/server-starter-all-features": "workspace:*",
"@ag-ui/vercel-ai-sdk": "workspace:*",
"@ai-sdk/openai": "^1.3.22",
"@ai-sdk/openai": "^2.0.22",
"ai": "^4.3.16",
"@copilotkit/react-core": "1.10.1",
"@copilotkit/react-ui": "1.10.1",
"@copilotkit/runtime": "1.10.1",
"@copilotkit/runtime-client-gql": "1.10.1",
"@copilotkit/shared": "1.10.1",
"@mastra/client-js": "^0.10.18",
"@mastra/core": "^0.13.0",
"@mastra/dynamodb": "^0.13.3",
"@mastra/libsql": "^0.13.0",
"@mastra/loggers": "^0.10.5",
"@mastra/memory": "^0.12.0",
"@mastra/client-js": "^0.12.3",
"@mastra/core": "0.16.3",
"@mastra/dynamodb": "^0.15.1",
"@mastra/libsql": "^0.14.1",
"@mastra/loggers": "^0.10.11",
"@mastra/memory": "^0.15.1",
"@mdx-js/loader": "^3.1.0",
"@mdx-js/mdx": "^3.1.0",
"@mdx-js/react": "^3.1.0",
Expand Down Expand Up @@ -66,7 +67,7 @@
"tailwind-merge": "^3.0.2",
"tailwindcss-animate": "^1.0.7",
"uuid": "^11.1.0",
"zod": "^3.22.4"
"zod": "^3.25.67"
},
"peerDependencies": {
"@ag-ui/client": "workspace:*",
Expand All @@ -92,4 +93,4 @@
"typescript": "^5",
"wait-port": "^1.1.0"
}
}
}
17 changes: 9 additions & 8 deletions typescript-sdk/apps/dojo/src/agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
return MastraAgent.getLocalAgents({ mastra });
},
},
{
id: "vercel-ai-sdk",
agents: async () => {
return {
agentic_chat: new VercelAISDKAgent({ model: openai("gpt-4o") }),
};
},
},
// Disabled until we can support Vercel AI SDK v5
// {
// id: "vercel-ai-sdk",
// agents: async () => {
// return {
// agentic_chat: new VercelAISDKAgent({ model: openai("gpt-4o") }),
// };
// },
// },
{
id: "langgraph",
agents: async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Chat = () => {
{
name: "background",
type: "string",
description: "The background. Prefer gradients.",
description: "The background. Prefer gradients. Only use when asked.",
},
],
handler: ({ background }) => {
Expand Down
48 changes: 11 additions & 37 deletions typescript-sdk/apps/dojo/src/files.json

Large diffs are not rendered by default.

65 changes: 56 additions & 9 deletions typescript-sdk/apps/dojo/src/mastra/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Memory } from "@mastra/memory";
import { LibSQLStore } from "@mastra/libsql";
import { DynamoDBStore } from "@mastra/dynamodb";

import { Mastra } from "@mastra/core";
import { createStep, createWorkflow, Mastra } from "@mastra/core";
import { createTool } from "@mastra/core";
import { z } from "zod";

Expand All @@ -13,17 +13,63 @@ import { z } from "zod";
function getStorage(): LibSQLStore | DynamoDBStore {
if (process.env.DYNAMODB_TABLE_NAME) {
return new DynamoDBStore({
name: "dynamodb",
config: {
tableName: process.env.DYNAMODB_TABLE_NAME
},
});
name: "dynamodb",
config: {
tableName: process.env.DYNAMODB_TABLE_NAME
},
});
} else {
return new LibSQLStore({ url: "file::memory:" });
}
}

export const weatherInfo = createTool({
id: "Get Weather Information",
description: `Fetches the current weather information for a given city`,
inputSchema: z.object({
city: z.string(),
}),
outputSchema: z.object({
text: z.string(),
}),
execute: async ({ writer }) => {
const step = createStep({
id: "weather-info",
inputSchema: z.object({}),
outputSchema: z.object({
text: z.string(),
}),
execute: async () => {
return {
text: "70 degrees"
}
}
})

const workflow = createWorkflow({
id: "weather-info",
inputSchema: z.object({}),
outputSchema: z.object({}),
steps: [step],
}).then(step).commit();

const run = await workflow.createRunAsync()

const stream = run.streamVNext()

for await (const chunk of stream) {
console.log('WORKFLOW CHUNK', chunk)
if ('payload' in chunk) {
await writer!.write({
type: `${chunk.from}-${chunk.type}`,
payload: chunk.payload,
})
}
}

return await stream.result as any;
},
});

export const mastra = new Mastra({
agents: {
Expand All @@ -38,10 +84,11 @@ export const mastra = new Mastra({
- If giving a location with multiple parts (e.g. "New York, NY"), use the most relevant part (e.g. "New York")
- Include relevant details like humidity, wind conditions, and precipitation
- Keep responses concise but informative

Use the weatherTool to fetch current weather data.
`,
`,
model: openai("gpt-4o"),
tools: {
weatherInfo
},
memory: new Memory({
storage: getStorage(),
options: {
Expand Down
11 changes: 6 additions & 5 deletions typescript-sdk/apps/dojo/src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,11 @@ export const menuIntegrations: MenuIntegrationConfig[] = [
"tool_based_generative_ui",
],
},
{
id: "vercel-ai-sdk",
name: "Vercel AI SDK",
features: ["agentic_chat"],
},
// Disabled until we can support Vercel AI SDK v5
// {
// id: "vercel-ai-sdk",
// name: "Vercel AI SDK",
// features: ["agentic_chat"],
// },
];

Loading
Loading