Skip to content

Commit 69bfb25

Browse files
committed
update dojo
1 parent 78467f4 commit 69bfb25

File tree

6 files changed

+234
-251
lines changed

6 files changed

+234
-251
lines changed

apps/dojo/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,6 @@ dist
141141
vite.config.js.timestamp-*
142142
vite.config.ts.timestamp-*
143143
.vite/
144+
145+
# Mastra files
146+
.mastra

apps/dojo/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
"tailwindcss-animate": "^1.0.7",
8080
"untruncate-json": "^0.0.1",
8181
"uuid": "^11.1.0",
82-
"zod": "^3.25.67"
82+
"zod": "^4.1.12"
8383
},
8484
"peerDependencies": {
8585
"@ag-ui/client": "workspace:*",
@@ -100,6 +100,7 @@
100100
"concurrently": "^9.2.0",
101101
"eslint": "^9",
102102
"eslint-config-next": "15.2.1",
103+
"mastra": "1.0.0-beta.1",
103104
"tailwindcss": "^4",
104105
"tsx": "^4.7.0",
105106
"typescript": "^5",

apps/dojo/src/agents.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import { ServerStarterAgent } from "@ag-ui/server-starter";
66
import { ServerStarterAllFeaturesAgent } from "@ag-ui/server-starter-all-features";
77
import { MastraClient } from "@mastra/client-js";
88
import { MastraAgent } from "@ag-ui/mastra";
9-
import { VercelAISDKAgent } from "@ag-ui/vercel-ai-sdk";
10-
import { openai } from "@ai-sdk/openai";
119
import { LangGraphAgent, LangGraphHttpAgent } from "@ag-ui/langgraph";
1210
import { AgnoAgent } from "@ag-ui/agno";
1311
import { LlamaIndexAgent } from "@ag-ui/llamaindex";
@@ -119,6 +117,7 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
119117
},
120118
},
121119
{
120+
// To use this, run "pnpm mastra:dev" in a separate terminal window
122121
id: "mastra",
123122
agents: async () => {
124123
const mastraClient = new MastraClient({

apps/dojo/src/mastra/index.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { openai } from "@ai-sdk/openai";
21
import { Agent } from "@mastra/core/agent";
32
import { Memory } from "@mastra/memory";
43
import { LibSQLStore } from "@mastra/libsql";
54
import { DynamoDBStore } from "@mastra/dynamodb";
6-
7-
import { createStep, createWorkflow, Mastra } from "@mastra/core";
8-
import { createTool } from "@mastra/core";
5+
import { Mastra } from "@mastra/core";
6+
import { createTool } from "@mastra/core/tools";
97
import { z } from "zod";
108
import { weatherTool } from "./tools";
119

@@ -14,11 +12,15 @@ function getStorage(): LibSQLStore | DynamoDBStore {
1412
return new DynamoDBStore({
1513
name: "dynamodb",
1614
config: {
15+
id: "storage-dynamodb",
1716
tableName: process.env.DYNAMODB_TABLE_NAME,
1817
},
1918
});
2019
} else {
21-
return new LibSQLStore({ url: "file::memory:" });
20+
return new LibSQLStore({
21+
id: "storage-memory",
22+
url: "file::memory:"
23+
});
2224
}
2325
}
2426

@@ -36,7 +38,7 @@ export const mastra = new Mastra({
3638
- Include relevant details like humidity, wind conditions, and precipitation
3739
- Keep responses concise but informative
3840
`,
39-
model: openai("gpt-4o"),
41+
model: "openai/gpt-4o",
4042
tools: { get_weather: weatherTool },
4143
memory: new Memory({
4244
storage: getStorage(),
@@ -51,7 +53,7 @@ export const mastra = new Mastra({
5153
}),
5254
}),
5355
backend_tool_rendering: new Agent({
54-
name: "Weather Agent",
56+
name: "backend_tool_rendering",
5557
instructions: `
5658
You are a helpful weather assistant that provides accurate weather information.
5759
@@ -64,7 +66,7 @@ export const mastra = new Mastra({
6466
6567
Use the weatherTool to fetch current weather data.
6668
`,
67-
model: openai("gpt-4o-mini"),
69+
model: "openai/gpt-4o-mini",
6870
tools: { get_weather: weatherTool },
6971
memory: new Memory({
7072
storage: getStorage(),
@@ -84,7 +86,7 @@ export const mastra = new Mastra({
8486
8587
If you have just created or modified the recipe, just answer in one sentence what you did. dont describe the recipe, just say what you did. Do not mention "working memory", "memory", or "state" in your answer.
8688
`,
87-
model: openai("gpt-4o"),
89+
model: "openai/gpt-4o",
8890
memory: new Memory({
8991
storage: getStorage(),
9092
options: {
@@ -143,7 +145,7 @@ export const mastra = new Mastra({
143145
instructions: `
144146
You are a helpful assistant for creating haikus.
145147
`,
146-
model: openai("gpt-4o"),
148+
model: "openai/gpt-4o",
147149
tools: {
148150
generate_haiku: createTool({
149151
id: "generate_haiku",
@@ -158,7 +160,7 @@ export const mastra = new Mastra({
158160
.describe("An array of three lines of the haiku in English"),
159161
}),
160162
outputSchema: z.string(),
161-
execute: async ({ context }) => {
163+
execute: async () => {
162164
return "Haiku generated.";
163165
},
164166
}),

apps/dojo/src/mastra/tools.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ export const weatherTool = createTool({
1616
conditions: z.string(),
1717
city: z.string(),
1818
}),
19-
execute: async ({ context }) => {
20-
return await getWeather(context.location);
19+
execute: async (inputData) => {
20+
return await getWeather(inputData.location);
2121
},
2222
});
2323

0 commit comments

Comments
 (0)