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

next
md 50 lines 1.95 KB
Rendered Raw
1 # Cloudflare Workers Compatibility Tests
2
3 Verifies that `@composio/core` runs correctly in the Cloudflare Workers runtime environment.
4
5 ## Why This Exists
6
7 Cloudflare Workers use a non-Node.js runtime (workerd) with:
8
9 - No native Node.js APIs (unless polyfilled)
10 - Different module resolution
11 - Restricted global scope
12 - Web-standard APIs (Fetch, Request, Response)
13
14 This suite ensures `@composio/core` works in this constrained environment without relying on Node.js-specific features.
15
16 ## What It Tests
17
18 | Test | Description |
19 | ---------------------- | ------------------------------------------------------------------- |
20 | Import & instantiation | Composio class imports and instantiates without runtime errors |
21 | Provider setup | OpenAIProvider initializes correctly |
22 | Tool retrieval | `getTools()` returns valid tool definitions |
23 | Live API call | Execute a real HackerNews action to verify end-to-end functionality |
24 | Uses LLMs? | ❌ |
25
26 ## Isolation Tool
27
28 - `wrangler`: Cloudflare's CLI that runs a local workerd instance
29 - `@cloudflare/vitest-pool-workers`: Runs Vitest tests inside the Workers runtime, not Node.js
30
31 This combination provides true runtime isolation—tests execute in the same environment as production Workers.
32
33 ## Setup
34
35 1. Copy `.env.example` to `.env` and add your `COMPOSIO_API_KEY`
36 2. Install dependencies: `pnpm install`
37
38 ## Running
39
40 ```bash
41 # Via pnpm (recommended)
42 pnpm test:e2e
43 ```
44
45 ## Configuration
46
47 | File | Purpose |
48 | ------------------- | ---------------------------------------------------- |
49 | `wrangler.jsonc` | Worker configuration (bindings, compatibility flags) |
50 | `vitest.config.mts` | Vitest setup with Workers pool and env bindings |