Skip to content

Commit d066f58

Browse files
committed
Merge branch 'main' into mme/client-side
2 parents 05e18d1 + 0a4057a commit d066f58

File tree

20 files changed

+6023
-1088
lines changed

20 files changed

+6023
-1088
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
![Discord](https://img.shields.io/discord/1379082175625953370?logo=discord&logoColor=%23FFFFFF&label=Discord&color=%236963ff)
33

44

5-
# <img src="https://github.com/user-attachments/assets/ebc0dd08-8732-4519-9b6c-452ce54d8058" alt="ag-ui Logo" height="42px" /> AG-UI: The Agent-User Interaction Protocol
5+
# <img src="https://github.com/user-attachments/assets/ebc0dd08-8732-4519-9b6c-452ce54d8058" alt="ag-ui Logo" width="45"/> AG-UI: The Agent-User Interaction Protocol
66
AG-UI is a lightweight, event-based protocol that standardizes how AI agents connect to front-end applications. Built for simplicity and flexibility, it enables seamless integration between your AI agents and user interfaces.
77

88
![AG-UI](https://github.com/user-attachments/assets/bec3bc01-d8f2-4667-885e-028cbcbc8439)

typescript-sdk/apps/dojo/next.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const nextConfig: NextConfig = {
2727

2828
return config;
2929
},
30+
serverExternalPackages: ["@mastra/libsql"],
3031
};
3132

3233
// Merge MDX config with Next.js config

typescript-sdk/apps/dojo/package.json

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,30 @@
66
"dev": "next dev",
77
"build": "next build",
88
"start": "next start",
9-
"lint": "next lint"
9+
"lint": "next lint",
10+
"mastra:dev": "mastra dev"
1011
},
1112
"dependencies": {
1213
"@ag-ui/agno": "workspace:*",
14+
"@ag-ui/crewai": "workspace:*",
1315
"@ag-ui/langgraph": "workspace:*",
1416
"@ag-ui/llamaindex": "workspace:*",
1517
"@ag-ui/mastra": "workspace:*",
1618
"@ag-ui/middleware-starter": "workspace:*",
1719
"@ag-ui/server-starter": "workspace:*",
1820
"@ag-ui/server-starter-all-features": "workspace:*",
1921
"@ag-ui/vercel-ai-sdk": "workspace:*",
20-
"@ag-ui/crewai": "workspace:*",
2122
"@ai-sdk/openai": "^1.3.22",
2223
"@copilotkit/react-core": "1.8.14-next.4",
2324
"@copilotkit/react-ui": "1.8.14-next.4",
2425
"@copilotkit/runtime": "1.8.14-next.4",
2526
"@copilotkit/runtime-client-gql": "1.8.14-next.4",
2627
"@copilotkit/shared": "1.8.14-next.4",
27-
"@mastra/client-js": "^0.10.1",
28+
"@mastra/client-js": "^0.10.9",
29+
"@mastra/core": "^0.10.10",
30+
"@mastra/libsql": "^0.11.0",
31+
"@mastra/loggers": "^0.10.3",
32+
"@mastra/memory": "^0.11.1",
2833
"@mdx-js/loader": "^3.1.0",
2934
"@mdx-js/mdx": "^3.1.0",
3035
"@mdx-js/react": "^3.1.0",
@@ -56,7 +61,8 @@
5661
"rxjs": "7.8.1",
5762
"tailwind-merge": "^3.0.2",
5863
"tailwindcss-animate": "^1.0.7",
59-
"uuid": "^11.1.0"
64+
"uuid": "^11.1.0",
65+
"zod": "^3.22.4"
6066
},
6167
"peerDependencies": {
6268
"@ag-ui/client": "workspace:*",
@@ -76,6 +82,7 @@
7682
"@types/react-dom": "^19",
7783
"eslint": "^9",
7884
"eslint-config-next": "15.2.1",
85+
"mastra": "^0.10.10",
7986
"tailwindcss": "^4",
8087
"typescript": "^5"
8188
}

typescript-sdk/apps/dojo/src/agents.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import "server-only";
2+
13
import { AgentIntegrationConfig } from "./types/integration";
24
import { MiddlewareStarterAgent } from "@ag-ui/middleware-starter";
35
import { ServerStarterAgent } from "@ag-ui/server-starter";
@@ -10,6 +12,7 @@ import { LangGraphAgent } from "@ag-ui/langgraph";
1012
import { AgnoAgent } from "@ag-ui/agno";
1113
import { LlamaIndexAgent } from "@ag-ui/llamaindex";
1214
import { CrewAIAgent } from "@ag-ui/crewai";
15+
import { mastra } from "./mastra";
1316

1417
export const agentsIntegrations: AgentIntegrationConfig[] = [
1518
{
@@ -65,6 +68,12 @@ export const agentsIntegrations: AgentIntegrationConfig[] = [
6568
});
6669
},
6770
},
71+
{
72+
id: "mastra-agent-local",
73+
agents: async () => {
74+
return MastraAgent.getLocalAgents({ mastra });
75+
},
76+
},
6877
{
6978
id: "vercel-ai-sdk",
7079
agents: async () => {

typescript-sdk/apps/dojo/src/app/[integrationId]/feature/agentic_chat/page.tsx

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React, { useState } from "react";
33
import "@copilotkit/react-ui/styles.css";
44
import "./style.css";
5-
import { CopilotKit, useCopilotAction, useCopilotChat } from "@copilotkit/react-core";
5+
import { CopilotKit, useCoAgent, useCopilotAction, useCopilotChat } from "@copilotkit/react-core";
66
import { CopilotChat } from "@copilotkit/react-ui";
77

88
interface AgenticChatProps {
@@ -29,34 +29,6 @@ const AgenticChat: React.FC<AgenticChatProps> = ({ params }) => {
2929
const Chat = () => {
3030
const [background, setBackground] = useState<string>("--copilot-kit-background-color");
3131

32-
useCopilotAction({
33-
name: "lookup_weather",
34-
description: "Lookup the weather for a given city",
35-
parameters: [
36-
{
37-
name: "city",
38-
type: "string",
39-
description: "The city to lookup the weather for",
40-
},
41-
{
42-
name: "weather",
43-
type: "string",
44-
description: "The weather for the city",
45-
},
46-
],
47-
render: ({ status, args }) => {
48-
return (
49-
<div>
50-
<div>
51-
Looked up weather for {args.city}: {args.weather}
52-
</div>
53-
<div>Status: {status}</div>
54-
</div>
55-
);
56-
},
57-
followUp: false,
58-
});
59-
6032
useCopilotAction({
6133
name: "change_background",
6234
description:
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import { openai } from "@ai-sdk/openai";
2+
import { Agent } from "@mastra/core/agent";
3+
import { Memory } from "@mastra/memory";
4+
import { LibSQLStore } from "@mastra/libsql";
5+
import { Mastra } from "@mastra/core";
6+
import { z } from "zod";
7+
8+
// import { weatherTool } from "../tools/weather-tool";
9+
10+
export const mastra = new Mastra({
11+
agents: {
12+
agentic_chat: new Agent({
13+
name: "agentic_chat",
14+
instructions: `
15+
You are a helpful weather assistant that provides accurate weather information.
16+
17+
Your primary function is to help users get weather details for specific locations. When responding:
18+
- Always ask for a location if none is provided
19+
- If the location name isn’t in English, please translate it
20+
- If giving a location with multiple parts (e.g. "New York, NY"), use the most relevant part (e.g. "New York")
21+
- Include relevant details like humidity, wind conditions, and precipitation
22+
- Keep responses concise but informative
23+
24+
Use the weatherTool to fetch current weather data.
25+
`,
26+
model: openai("gpt-4o"),
27+
// tools: { weatherTool },
28+
memory: new Memory({
29+
storage: new LibSQLStore({ url: "file::memory:" }),
30+
options: {
31+
workingMemory: {
32+
enabled: true,
33+
schema: z.object({
34+
firstName: z.string(),
35+
}),
36+
},
37+
},
38+
}),
39+
}),
40+
shared_state: new Agent({
41+
name: "shared_state",
42+
instructions: `
43+
You are a helpful assistant for creating recipes.
44+
45+
IMPORTANT:
46+
1. Create a recipe using the existing ingredients and instructions. Make sure the recipe is complete.
47+
2. For ingredients, append new ingredients to the existing ones.
48+
3. For instructions, append new steps to the existing ones.
49+
4. 'ingredients' is always an array of objects with 'icon', 'name', and 'amount' fields
50+
5. 'instructions' is always an array of strings
51+
52+
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.
53+
`,
54+
model: openai("gpt-4o"),
55+
memory: new Memory({
56+
storage: new LibSQLStore({ url: "file::memory:" }),
57+
options: {
58+
workingMemory: {
59+
enabled: true,
60+
schema: z.object({
61+
recipe: z.object({
62+
skill_level: z
63+
.enum(["Beginner", "Intermediate", "Advanced"])
64+
.describe("The skill level required for the recipe"),
65+
special_preferences: z
66+
.array(
67+
z.enum([
68+
"High Protein",
69+
"Low Carb",
70+
"Spicy",
71+
"Budget-Friendly",
72+
"One-Pot Meal",
73+
"Vegetarian",
74+
"Vegan",
75+
]),
76+
)
77+
.describe("A list of special preferences for the recipe"),
78+
cooking_time: z
79+
.enum(["5 min", "15 min", "30 min", "45 min", "60+ min"])
80+
.describe("The cooking time of the recipe"),
81+
ingredients: z
82+
.array(
83+
z.object({
84+
icon: z
85+
.string()
86+
.describe(
87+
"The icon emoji (not emoji code like '\x1f35e', but the actual emoji like 🥕) of the ingredient",
88+
),
89+
name: z.string().describe("The name of the ingredient"),
90+
amount: z.string().describe("The amount of the ingredient"),
91+
}),
92+
)
93+
.describe(
94+
"Entire list of ingredients for the recipe, including the new ingredients and the ones that are already in the recipe",
95+
),
96+
instructions: z
97+
.array(z.string())
98+
.describe(
99+
"Entire list of instructions for the recipe, including the new instructions and the ones that are already there",
100+
),
101+
changes: z.string().describe("A description of the changes made to the recipe"),
102+
}),
103+
}),
104+
},
105+
},
106+
}),
107+
}),
108+
},
109+
});

typescript-sdk/apps/dojo/src/menu.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const menuIntegrations: MenuIntegrationConfig[] = [
1313
},
1414
{
1515
id: "server-starter-all-features",
16-
name: "Server Starter All Features",
16+
name: "Server Starter (All Features)",
1717
features: [
1818
"agentic_chat",
1919
"human_in_the_loop",
@@ -28,6 +28,11 @@ export const menuIntegrations: MenuIntegrationConfig[] = [
2828
name: "Mastra",
2929
features: ["agentic_chat"],
3030
},
31+
{
32+
id: "mastra-agent-local",
33+
name: "Mastra Agent (Local)",
34+
features: ["agentic_chat", "shared_state"],
35+
},
3136
{
3237
id: "vercel-ai-sdk",
3338
name: "Vercel AI SDK",

typescript-sdk/apps/dojo/tsconfig.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
}
2020
],
2121
"paths": {
22-
"@/*": ["./src/*"]
22+
"@/*": ["./src/*", "../../packages/client/src/*"],
23+
"@ag-ui/client": ["../../packages/client/src"],
24+
"@ag-ui/client/*": ["../../packages/client/src/*"]
2325
}
2426
},
2527
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],

typescript-sdk/integrations/mastra/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ag-ui/mastra",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"license": "Elastic-2.0",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",
@@ -25,16 +25,16 @@
2525
"dependencies": {
2626
"@ag-ui/client": "workspace:*",
2727
"@ai-sdk/ui-utils": "^1.1.19",
28-
"@mastra/client-js": "^0.10.1",
29-
"hono": "^4.5.1",
28+
"@mastra/client-js": "^0.10.9",
3029
"rxjs": "7.8.1"
3130
},
3231
"peerDependencies": {
3332
"@copilotkit/runtime": "^1.8.13",
34-
"@mastra/core": "^0.10.1",
35-
"zod": "^3.0.0"
33+
"@mastra/core": "^0.10.10",
34+
"zod": "^3.25.67"
3635
},
3736
"devDependencies": {
37+
"@mastra/core": "^0.10.10",
3838
"@types/jest": "^29.5.14",
3939
"@types/node": "^20.11.19",
4040
"jest": "^29.7.0",

0 commit comments

Comments
 (0)