@devries-cameron20 / composio Mirror · read-only / commits / d787107df
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.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 14:45 UTC

fix(examples): declare provider deps and drop magic-flow-demo (#4221)

Follow-up to the live-sweep findings in #4135. Independent of it — this targets `next` directly. ## Python entries could never resolve their provider imports `harness/run.mjs` runs each Python entry as `uv run --project python [--with <dep>]... python <file>`. The base environment is the `python` project only, so the provider packages are present just when an entry names them in `pyWith`. Six entries import a provider and declared none, and have failed with `ModuleNotFoundError` every time the sweep has run since it landed on 2026-08-14: | entry | imports | had | | --- | --- | --- | | `py/tool_router/files` | `composio_openai` | no `pyWith` | | `py/tool_router/preload` | `composio_openai_agents` | `openai-agents>=0.19` only | | `py/tool_router/direct_tools_preset` | `composio_openai_agents` | `openai-agents>=0.19` only | | `py/tool_router/tools` | `composio_openai_agents` | `openai-agents>=0.19` only | | `py/tool_router/tool_router_mcp` | `composio_openai_agents` | `openai-agents>=0.19` only | | `py/custom_tools_agent_test` | `composio_openai_agents` | `openai-agents>=0.19` only | Those entries declared the upstream `openai-agents` SDK but not the Composio provider built on it. ### Why local paths, not package names A bare `--with composio-openai-agents` resolves from **PyPI**, so the sweep would exercise the published provider rather than this repo's — and it drags the published `composio` in with it. Declaring `./python/providers/<name>` plus `./python` keeps both local. Verified in the resulting overlay: ``` composio : file:///…/composio2/python composio-openai : file:///…/composio2/python/providers/openai ``` `py/tool_router/claude_agent` already had `./python` but named its provider, so it was testing the **published** `composio-claude-agent-sdk` against the repo's `composio` (confirmed: that dist has no `direct_url.json`). Pointed at the local path too, so every entry now tests repo code under one convention. ## Deleting `ts/connected-accounts/magic-flow-demo` - Not substantively touched since **2025-06-20** — ~14 months. The only later commits are a model-version bump and its same-day revert, which net to zero. - It calls an endpoint the backend has retired. The sweep gets `400`: *"Creating connections on this endpoint for Composio-managed OAuth auth configs is no longer supported. Use POST /api/v3/connected_accounts/link instead."* - It could not pass unattended even if that were fixed: `waitForConnection()` blocks until a human completes a browser OAuth grant. Removed the source, its manifest entry, and its README bullet. Rewriting it onto `/connected_accounts/link` would be a genuinely new example rather than a repair, so it seemed better to drop it than to carry a broken one. ## Verified against the live staging backend Not just locally — these entries were **executed** against `staging-backend.composio.dev` (`llm=mock`, zero model spend): ``` provisioned state: complete sweep 20260823224239-lk9413-baseline-mock: 5 entries ✓ py/tool_router/toolkits (5.8s) ✓ py/tool_router/preload (11.1s) ✓ py/tool_router/direct_tools_preset (11.2s) ✓ py/tool_router/files (12.3s) ✓ py/auth_configs (3.9s) sweep: 5 green / 0 red / 0 skipped ``` All three previously-broken entries now pass end to end; `toolkits` and `auth_configs` ran as unchanged controls. As far as I can tell from the workflow history, this is the first time any of these examples has completed green — the nightly has failed at `Verify provisioned project state` on every run since it was introduced. The run needed a branch carrying both these fixes and #4135's scoped provisioning, since `next`'s provisioning tries to create a `googledrive` auth config and dies before sweeping anything. That branch was throwaway and is deleted. Other checks: `node harness/run.mjs selftest` passes, `pnpm run test:examples` validates 20 packages, the connected-accounts package typechecks, and all 92 remaining manifest entries point at files that exist. ### Still unproven The other three entries fixed here — `tools`, `tool_router_mcp`, `custom_tools_agent_test` — need github/gmail connected accounts, which staging does not yet have. They get past their imports but cannot be run end to end until those grants exist. `py/modifiers` is `tier=X`, excluded by design. ## Related `py/tool_router/tool_router_mcp` also exits **0** when `COMPOSIO_API_KEY` is unset, so the harness would score it green while it did nothing. Fixed separately in #4222.

Alberto Schiabel committed Aug 24, 2026 at 00:47 UTC d787107dfac5e2a388a215680ff10df9d7885324
3 files changed +21 -73
examples-manifest.json
+21 -19
@@ -118,18 +118,6 @@
118 "toolkits": [],
119 "timeoutSec": 90
120 },
121 - {
122 - "id": "ts/connected-accounts/magic-flow-demo",
123 - "lang": "ts",
124 - "pkg": "connected-accounts-example",
125 - "file": "ts/examples/connected-accounts/src/magic-flow-demo.ts",
126 - "tier": "3",
127 - "env": [
128 - "OPENAI_API_KEY"
129 - ],
130 - "readiness": "Redirect the user to https?://",
131 - "timeoutSec": 120
132 - },
121 {
122 "id": "ts/connected-accounts/multiple-connected-accounts",
123 "lang": "ts",
@@ -1073,7 +1061,9 @@
1061 ],
1062 "timeoutSec": 240,
1063 "pyWith": [
1076 - "openai-agents>=0.19"
1064 + "openai-agents>=0.19",
1065 + "./python/providers/openai_agents",
1066 + "./python"
1067 ]
1068 },
1069 {
@@ -1131,7 +1121,7 @@
1121 ],
1122 "pyWith": [
1123 "claude-agent-sdk",
1134 - "composio-claude-agent-sdk",
1124 + "./python/providers/claude_agent_sdk",
1125 "./python"
1126 ],
1127 "timeoutSec": 300,
@@ -1171,7 +1161,9 @@
1161 ],
1162 "timeoutSec": 180,
1163 "pyWith": [
1174 - "openai-agents>=0.19"
1164 + "openai-agents>=0.19",
1165 + "./python/providers/openai_agents",
1166 + "./python"
1167 ]
1168 },
1169 {
@@ -1187,7 +1179,9 @@
1179 ],
1180 "timeoutSec": 180,
1181 "pyWith": [
1190 - "openai-agents>=0.19"
1182 + "openai-agents>=0.19",
1183 + "./python/providers/openai_agents",
1184 + "./python"
1185 ]
1186 },
1187 {
@@ -1199,7 +1193,11 @@
1193 "OPENAI_API_KEY"
1194 ],
1195 "toolkits": [],
1202 - "timeoutSec": 180
1196 + "timeoutSec": 180,
1197 + "pyWith": [
1198 + "./python/providers/openai",
1199 + "./python"
1200 + ]
1201 },
1202 {
1203 "id": "py/tool_router/langchain_agent",
@@ -1252,7 +1250,9 @@
1250 ],
1251 "timeoutSec": 240,
1252 "pyWith": [
1255 - "openai-agents>=0.19"
1253 + "openai-agents>=0.19",
1254 + "./python/providers/openai_agents",
1255 + "./python"
1256 ]
1257 },
1258 {
@@ -1287,7 +1287,9 @@
1287 ],
1288 "timeoutSec": 180,
1289 "pyWith": [
1290 - "openai-agents>=0.19"
1290 + "openai-agents>=0.19",
1291 + "./python/providers/openai_agents",
1292 + "./python"
1293 ]
1294 }
1295 ]
ts/examples/connected-accounts/README.md
-1
@@ -14,7 +14,6 @@ Connected accounts in Composio enable your application to interact with third-pa
14 ## Example Files
15
16 - **toolkit-authorize.ts**: Demonstrates authorizing a toolkit and waiting for the connection
17 -- **magic-flow-demo.ts**: Shows how to use the magic flow for a streamlined connection experience
17 - **index.ts**: Basic entry point that imports the examples
18
19 ## Using the waitForConnection Method
ts/examples/connected-accounts/src/magic-flow-demo.ts deleted
-53
@@ -1,53 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { OpenAI } from 'openai';
3 -
4 -const userId = 'default';
5 -
6 -const composio = new Composio({
7 - apiKey: process.env.COMPOSIO_API_KEY,
8 -});
9 -
10 -const openai = new OpenAI({
11 - apiKey: process.env.OPENAI_API_KEY,
12 -});
13 -
14 -// ------------------------------------------------------------
15 -// 1. Authorize the user to GitHub
16 -// ------------------------------------------------------------
17 -
18 -const connectionRequest = await composio.toolkits.authorize(userId, 'github');
19 -// Redirect the user to continue to auth flow
20 -const redirectUrl = connectionRequest.redirectUrl;
21 -
22 -console.log(`Redirect the user to ${redirectUrl}`);
23 -
24 -// Wait for the user to connect the account / singin to GitHub
25 -const connectedAccount = await connectionRequest.waitForConnection();
26 -
27 -console.log(`Connected account created: ${JSON.stringify(connectedAccount, null, 2)}`);
28 -
29 -// ------------------------------------------------------------
30 -// 2. Get the GitHub tools
31 -// ------------------------------------------------------------
32 -
33 -const tools = await composio.tools.get(userId, {
34 - toolkits: ['github'],
35 -});
36 -
37 -// ------------------------------------------------------------
38 -// 3. Use the Composio GitHub tools with OpenAI
39 -// ------------------------------------------------------------
40 -const task = 'Star the composio repository on GitHub';
41 -const messages: OpenAI.ChatCompletionMessageParam[] = [
42 - { role: 'system', content: 'You are a helpful assistant that can help with tasks.' },
43 - { role: 'user', content: task },
44 -];
45 -
46 -const response = await openai.chat.completions.create({
47 - model: 'gpt-4o-mini',
48 - messages,
49 - tools: tools,
50 - tool_choice: 'auto',
51 -});
52 -
53 -console.log(`Response: ${JSON.stringify(response, null, 2)}`);