Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | /** |
| 2 | * Mastra × Composio — direct tools |
| 3 | * |
| 4 | * Fetches a Composio tool as a Mastra tool and lets a Mastra Agent call it. |
| 5 | * Uses the unauthenticated HACKERNEWS toolkit, so no connected account is |
| 6 | * required — set only the two keys below and run. |
| 7 | * |
| 8 | * Prerequisites: |
| 9 | * - COMPOSIO_API_KEY (https://app.composio.dev) |
| 10 | * - OPENAI_API_KEY (or swap the model — see README) |
| 11 | * |
| 12 | * Run: |
| 13 | * bun ts/examples/mastra/src/index.ts |
| 14 | */ |
| 15 | import 'dotenv/config'; |
| 16 | |
| 17 | import { runDirectHackerNewsAgent } from './hackernews-agent/direct'; |
| 18 | |
| 19 | const text = await runDirectHackerNewsAgent(process.env); |
| 20 | |
| 21 | console.log('\n🤖 Agent response:\n'); |
| 22 | console.log(text); |