Skip to content
Merged
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
1 change: 1 addition & 0 deletions typescript-sdk/apps/dojo/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const nextConfig: NextConfig = {

return config;
},
serverExternalPackages: ["@mastra/libsql"],
};

// Merge MDX config with Next.js config
Expand Down
15 changes: 11 additions & 4 deletions typescript-sdk/apps/dojo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,30 @@
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"mastra:dev": "mastra dev"
},
"dependencies": {
"@ag-ui/agno": "workspace:*",
"@ag-ui/crewai": "workspace:*",
"@ag-ui/langgraph": "workspace:*",
"@ag-ui/llamaindex": "workspace:*",
"@ag-ui/mastra": "workspace:*",
"@ag-ui/middleware-starter": "workspace:*",
"@ag-ui/server-starter": "workspace:*",
"@ag-ui/server-starter-all-features": "workspace:*",
"@ag-ui/vercel-ai-sdk": "workspace:*",
"@ag-ui/crewai": "workspace:*",
"@ai-sdk/openai": "^1.3.22",
"@copilotkit/react-core": "1.8.14-next.4",
"@copilotkit/react-ui": "1.8.14-next.4",
"@copilotkit/runtime": "1.8.14-next.4",
"@copilotkit/runtime-client-gql": "1.8.14-next.4",
"@copilotkit/shared": "1.8.14-next.4",
"@mastra/client-js": "^0.10.1",
"@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",
"@mdx-js/loader": "^3.1.0",
"@mdx-js/mdx": "^3.1.0",
"@mdx-js/react": "^3.1.0",
Expand Down Expand Up @@ -56,7 +61,8 @@
"rxjs": "7.8.1",
"tailwind-merge": "^3.0.2",
"tailwindcss-animate": "^1.0.7",
"uuid": "^11.1.0"
"uuid": "^11.1.0",
"zod": "^3.22.4"
},
"peerDependencies": {
"@ag-ui/client": "workspace:*",
Expand All @@ -76,6 +82,7 @@
"@types/react-dom": "^19",
"eslint": "^9",
"eslint-config-next": "15.2.1",
"mastra": "^0.10.10",
"tailwindcss": "^4",
"typescript": "^5"
}
Expand Down
9 changes: 9 additions & 0 deletions typescript-sdk/apps/dojo/src/agents.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import "server-only";

import { AgentIntegrationConfig } from "./types/integration";
import { MiddlewareStarterAgent } from "@ag-ui/middleware-starter";
import { ServerStarterAgent } from "@ag-ui/server-starter";
Expand All @@ -10,6 +12,7 @@ import { LangGraphAgent } from "@ag-ui/langgraph";
import { AgnoAgent } from "@ag-ui/agno";
import { LlamaIndexAgent } from "@ag-ui/llamaindex";
import { CrewAIAgent } from "@ag-ui/crewai";
import { mastra } from "./mastra";

export const agentsIntegrations: AgentIntegrationConfig[] = [
{
Expand Down Expand Up @@ -65,6 +68,12 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
});
},
},
{
id: "mastra-agent-local",
agents: async () => {
return MastraAgent.getLocalAgents({ mastra });
},
},
{
id: "vercel-ai-sdk",
agents: async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import React, { useState } from "react";
import "@copilotkit/react-ui/styles.css";
import "./style.css";
import { CopilotKit, useCopilotAction, useCopilotChat } from "@copilotkit/react-core";
import { CopilotKit, useCoAgent, useCopilotAction, useCopilotChat } from "@copilotkit/react-core";
import { CopilotChat } from "@copilotkit/react-ui";

interface AgenticChatProps {
Expand Down
109 changes: 109 additions & 0 deletions typescript-sdk/apps/dojo/src/mastra/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import { openai } from "@ai-sdk/openai";
import { Agent } from "@mastra/core/agent";
import { Memory } from "@mastra/memory";
import { LibSQLStore } from "@mastra/libsql";
import { Mastra } from "@mastra/core";
import { z } from "zod";

// import { weatherTool } from "../tools/weather-tool";

export const mastra = new Mastra({
agents: {
agentic_chat: new Agent({
name: "agentic_chat",
instructions: `
You are a helpful weather assistant that provides accurate weather information.

Your primary function is to help users get weather details for specific locations. When responding:
- Always ask for a location if none is provided
- If the location name isn’t in English, please translate it
- 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: { weatherTool },
memory: new Memory({
storage: new LibSQLStore({ url: "file::memory:" }),
options: {
workingMemory: {
enabled: true,
schema: z.object({
firstName: z.string(),
}),
},
},
}),
}),
shared_state: new Agent({
name: "shared_state",
instructions: `
You are a helpful assistant for creating recipes.

IMPORTANT:
1. Create a recipe using the existing ingredients and instructions. Make sure the recipe is complete.
2. For ingredients, append new ingredients to the existing ones.
3. For instructions, append new steps to the existing ones.
4. 'ingredients' is always an array of objects with 'icon', 'name', and 'amount' fields
5. 'instructions' is always an array of strings

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.
`,
model: openai("gpt-4o"),
memory: new Memory({
storage: new LibSQLStore({ url: "file::memory:" }),
options: {
workingMemory: {
enabled: true,
schema: z.object({
recipe: z.object({
skill_level: z
.enum(["Beginner", "Intermediate", "Advanced"])
.describe("The skill level required for the recipe"),
special_preferences: z
.array(
z.enum([
"High Protein",
"Low Carb",
"Spicy",
"Budget-Friendly",
"One-Pot Meal",
"Vegetarian",
"Vegan",
]),
)
.describe("A list of special preferences for the recipe"),
cooking_time: z
.enum(["5 min", "15 min", "30 min", "45 min", "60+ min"])
.describe("The cooking time of the recipe"),
ingredients: z
.array(
z.object({
icon: z
.string()
.describe(
"The icon emoji (not emoji code like '\x1f35e', but the actual emoji like 🥕) of the ingredient",
),
name: z.string().describe("The name of the ingredient"),
amount: z.string().describe("The amount of the ingredient"),
}),
)
.describe(
"Entire list of ingredients for the recipe, including the new ingredients and the ones that are already in the recipe",
),
instructions: z
.array(z.string())
.describe(
"Entire list of instructions for the recipe, including the new instructions and the ones that are already there",
),
changes: z.string().describe("A description of the changes made to the recipe"),
}),
}),
},
},
}),
}),
},
});
7 changes: 6 additions & 1 deletion typescript-sdk/apps/dojo/src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const menuIntegrations: MenuIntegrationConfig[] = [
},
{
id: "server-starter-all-features",
name: "Server Starter All Features",
name: "Server Starter (All Features)",
features: [
"agentic_chat",
"human_in_the_loop",
Expand All @@ -28,6 +28,11 @@ export const menuIntegrations: MenuIntegrationConfig[] = [
name: "Mastra",
features: ["agentic_chat"],
},
{
id: "mastra-agent-local",
name: "Mastra Agent (Local)",
features: ["agentic_chat", "shared_state"],
},
{
id: "vercel-ai-sdk",
name: "Vercel AI SDK",
Expand Down
8 changes: 4 additions & 4 deletions typescript-sdk/integrations/mastra/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
"dependencies": {
"@ag-ui/client": "workspace:*",
"@ai-sdk/ui-utils": "^1.1.19",
"@mastra/client-js": "^0.10.1",
"hono": "^4.5.1",
"@mastra/client-js": "^0.10.9",
"rxjs": "7.8.1"
},
"peerDependencies": {
"@copilotkit/runtime": "^1.8.13",
"@mastra/core": "^0.10.1",
"zod": "^3.0.0"
"@mastra/core": "^0.10.10",
"zod": "^3.25.67"
},
"devDependencies": {
"@mastra/core": "^0.10.10",
"@types/jest": "^29.5.14",
"@types/node": "^20.11.19",
"jest": "^29.7.0",
Expand Down
Loading