Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 04:45 UTC
| 1 | /** |
| 2 | * Mastra × Composio — Cloudflare Workers |
| 3 | * |
| 4 | * Proves the same Tool Router agent path runs on the Workers runtime, not just |
| 5 | * Node. Reads config from the Worker `env` binding (no `process.env`). |
| 6 | * |
| 7 | * This entry is what the per-PR CI validates with `wrangler deploy --dry-run`. |
| 8 | * |
| 9 | * Local dev: |
| 10 | * cd ts/examples/mastra && bun run cf:dev # then GET http://localhost:8787/ |
| 11 | * Deploy config: wrangler.jsonc |
| 12 | */ |
| 13 | import { |
| 14 | runToolRouterHackerNewsAgent, |
| 15 | type ToolRouterHackerNewsAgentEnvironment, |
| 16 | } from './hackernews-agent/tool-router'; |
| 17 | |
| 18 | export type Env = Required<ToolRouterHackerNewsAgentEnvironment>; |
| 19 | |
| 20 | export default { |
| 21 | async fetch(_request: Request, env: Env): Promise<Response> { |
| 22 | const text = await runToolRouterHackerNewsAgent(env); |
| 23 | |
| 24 | return new Response(text, { |
| 25 | headers: { 'content-type': 'text/plain; charset=utf-8' }, |
| 26 | }); |
| 27 | }, |
| 28 | }; |