Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
feat(ts): update some mastra examples
jkomyno35684cd17c70
diff --git a/ts/examples/mastra/package.json b/ts/examples/mastra/package.jsonindex 67302e816..d48e6595d 100644--- a/ts/examples/mastra/package.json+++ b/ts/examples/mastra/package.json@@ -24,11 +24,10 @@"license": "ISC","packageManager": "[email protected]","dependencies": {- "@ai-sdk/openai": "^1.3.16",+ "@ai-sdk/openai": "^3.0.13","@composio/core": "workspace:*","@composio/mastra": "workspace:*",- "@mastra/core": "^0.24.5",- "@mastra/mcp": "^0.12.0",+ "@mastra/core": "^1.0.4","dotenv": "^16.4.1","zod": "catalog:"},diff --git a/ts/examples/mastra/src/index.ts b/ts/examples/mastra/src/index.tsindex 53edaae9b..7e207d19e 100644--- a/ts/examples/mastra/src/index.ts+++ b/ts/examples/mastra/src/index.ts@@ -51,6 +51,7 @@ const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER', {* Create the mastra agent*/const hackernewsAgent = new Agent({+ id: 'test-mastra',name: 'Weather Agent',instructions:'You are a helpful assistant that can use the Hackernews API to get user information.',diff --git a/ts/examples/mastra/src/send-email.ts b/ts/examples/mastra/src/send-email.tsnew file mode 100644index 000000000..b5f20cb9d--- /dev/null+++ b/ts/examples/mastra/src/send-email.ts@@ -0,0 +1,41 @@+import { openai } from '@ai-sdk/openai'+import { Composio } from "@composio/core";+import { MastraProvider } from "@composio/mastra";+import { Agent } from "@mastra/core/agent";++const composio = new Composio({+ provider: new MastraProvider(),+ apiKey: process.env.COMPOSIO_API_KEY,+});+++const tools = await composio.tools.get(+ 'default',+ {+ tools: ["GMAIL_SEND_EMAIL"],+ }+);++const agent = new Agent({+ id: 'test-mastra',+ name: "Gmail Agent",+ instructions: "You are a helpful Gmail assistant that provides concise answers.",+ description: "Gmail agent",+ model: openai('gpt-5.2'),+ tools: tools,+});++// const toolsFromAgent = agent.listTools();+// console.dir(toolsFromAgent, { depth: null });++const { text, error } = await agent.generate([+ { role: "user", content: "Send an email to [email protected] saying \"Hi from Mastra\"" },+]);++if (error) {+ console.error("\n🤖 Agent Error:\n");+ console.error(error);+} else {+ console.log("\n🤖 Agent Response:\n");+ console.log(text);+}