@devries-cameron20 / composio-1 / commits / 35684cd17
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

feat(ts): update some mastra examples

jkomyno committed Jan 22, 2026 at 03:39 UTC 35684cd17c70205b919034a55c93ae60e4e4e356
3 files changed +44 -3
ts/examples/mastra/package.json
+2 -3
@@ -24,11 +24,10 @@
24 "license": "ISC",
25 "packageManager": "pnpm@10.28.0",
26 "dependencies": {
27 - "@ai-sdk/openai": "^1.3.16",
27 + "@ai-sdk/openai": "^3.0.13",
28 "@composio/core": "workspace:*",
29 "@composio/mastra": "workspace:*",
30 - "@mastra/core": "^0.24.5",
31 - "@mastra/mcp": "^0.12.0",
30 + "@mastra/core": "^1.0.4",
31 "dotenv": "^16.4.1",
32 "zod": "catalog:"
33 },
ts/examples/mastra/src/index.ts
+1
@@ -51,6 +51,7 @@ const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER', {
51 * Create the mastra agent
52 */
53 const hackernewsAgent = new Agent({
54 + id: 'test-mastra',
55 name: 'Weather Agent',
56 instructions:
57 'You are a helpful assistant that can use the Hackernews API to get user information.',
ts/examples/mastra/src/send-email.ts new
+41
@@ -0,0 +1,41 @@
1 +import { openai } from '@ai-sdk/openai'
2 +import { Composio } from "@composio/core";
3 +import { MastraProvider } from "@composio/mastra";
4 +import { Agent } from "@mastra/core/agent";
5 +
6 +const composio = new Composio({
7 + provider: new MastraProvider(),
8 + apiKey: process.env.COMPOSIO_API_KEY,
9 +});
10 +
11 +
12 +const tools = await composio.tools.get(
13 + 'default',
14 + {
15 + tools: ["GMAIL_SEND_EMAIL"],
16 + }
17 +);
18 +
19 +const agent = new Agent({
20 + id: 'test-mastra',
21 + name: "Gmail Agent",
22 + instructions: "You are a helpful Gmail assistant that provides concise answers.",
23 + description: "Gmail agent",
24 + model: openai('gpt-5.2'),
25 + tools: tools,
26 +});
27 +
28 +// const toolsFromAgent = agent.listTools();
29 +// console.dir(toolsFromAgent, { depth: null });
30 +
31 +const { text, error } = await agent.generate([
32 + { role: "user", content: "Send an email to uday@composio.dev saying \"Hi from Mastra\"" },
33 +]);
34 +
35 +if (error) {
36 + console.error("\n🤖 Agent Error:\n");
37 + console.error(error);
38 +} else {
39 + console.log("\n🤖 Agent Response:\n");
40 + console.log(text);
41 +}