44 Commits

Author SHA1 Message Date
Brendan O'Leary a92d4920f0 docs: finish priority guide integration 2026-09-15 10:08:10 -04:00
Alberto Schiabel 41be258076 fix(examples): fail tool_router_mcp when COMPOSIO_API_KEY is unset (#4222)
Spotted while fixing the provider-dependency failures in #4221.

## Problem

`python/examples/tool_router/tool_router_mcp.py` guarded a missing
credential like this:

```python
api_key = os.environ.get("COMPOSIO_API_KEY")
if not api_key:
    print("Error: COMPOSIO_API_KEY environment variable not set")
    print("Please set it using: export COMPOSIO_API_KEY='your_api_key'")
    return
```

`return` exits the coroutine normally, so `asyncio.run(main())`
completes and the process exits **0**. The live-examples harness scores
entries by exit code, so a run that did nothing at all was recorded
**green** — the worst kind of failure for a canary, since it reports
success while testing nothing.

## Fix

Raise instead, using the `require_env` helper the sibling examples
already use (`examples/tool_router/preload.py`):

```python
def require_env(name: str) -> str:
    value = os.environ.get(name)
    if not value:
        raise RuntimeError(f"Set {name} before running this example.")
    return value
```

## Verification

Replaying the harness's own invocation with the variable unset:

```
$ unset COMPOSIO_API_KEY
$ uv run --project python --with 'openai-agents>=0.19' \
    --with ./python/providers/openai_agents --with ./python \
    python python/examples/tool_router/tool_router_mcp.py

before: exit=0        # silently "passes"
after:  exit=1        # RuntimeError: Set COMPOSIO_API_KEY before running this example.
```

`ruff check`, `ruff format --check`, and `nox -s chk_examples` all pass.

## Scope

I checked whether other examples share the pattern.
`examples/tool_router/authorize.py` prints the same message, but calls
`exit(1)` at module level rather than returning from a coroutine, so it
already fails correctly — left alone. This was the only instance.
2026-08-25 00:28:30 +02:00
Sarah Simionescu 5608d89cbc docs(auth): point custom OAuth callback URL to v1
Consumer product and the backend-provided default redirect URI use the
v1 callback (api/v1/auth-apps/add), but the developer docs instructed the
v3.1 URL (api/v3.1/toolkits/auth/callback). Users copied the wrong URL
into their OAuth app allow lists. Align all instructional docs + the
Python example with v1.

The migration guide (migration-guide/new-sdk.mdx) is left unchanged: it
documents the v1->v3 history and flipping it would make it contradictory.

Fixes UXE-261.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-08-21 22:53:42 -07:00
Alberto Schiabel 8086ef02cb fix(examples): align Python and TypeScript examples with current backend (#4107)
## Summary

- Repairs runnable TypeScript and Python examples for current backend
requirements, including authenticated MCP endpoints, current transports,
valid tool identifiers, provider limits, and resource uniqueness.
- Replaces placeholder resource IDs with explicit `COMPOSIO_EXAMPLES_*`
configuration and makes failed examples exit loudly.
- Adds `scripts/examples-provision.mjs` as an idempotent provisioning
check for a disposable examples project.

## Scope

- This PR no longer changes the Python SDK runtime or generated-client
dependency.
- Python remains pinned to the published `composio-client==1.43.0` in
`pyproject.toml`, `setup.py`, and `uv.lock`.
- The owned 2.x client integration is deferred until that client
completes its release guarantees and is explicitly published.
- The scheduled live workflow and manifest remain deferred until their
runner is tracked.

## Verification

- `make chk`
- `make tst` (`927 passed, 33 skipped`)
- Hosted checks rerun against commit `12691aca7`.
2026-08-11 19:45:58 +02:00
Alberto Schiabel 2758287c87 feat(py): remove legacy custom tools (#3508)
This PR is **part 1 of 3** splitting
https://github.com/ComposioHQ/composio/pull/3505 to make the removal of
the old 2025 custom tools easier to review. It carries the **Python**
slice.

- removes the legacy `composio.tools.custom_tool` registry path:
`core.models.custom_tools`, `ExecuteRequestFn`, the old fallback
execution wiring, the security tests, and the example
- preserves the 2026 tool-router APIs: `composio.experimental.tool()`,
`composio.experimental.Toolkit`, inline custom-tool execution,
preload/attach/use flows, and `session.custom_tools()`
- bumps the Python workspace and all provider packages `0.13.1` →
`0.14.0`

## Notes

- This slice is a byte-identical subset of #3505 — the three split
branches recombine to that PR's exact tree. See #3505 for the original
local verification logs (`uv run --frozen nox -s chk`, targeted pytest);
CI re-runs per PR.
2026-06-04 23:53:26 -07:00
Dhawal Upadhyay ffb7539bb5 Fix ToolRouter example staging runs 2026-05-07 16:42:08 +05:30
Dhawal Upadhyay bccd32beae Refine ToolRouter preload docs and constants 2026-05-07 16:10:38 +05:30
Abir Taheer df857bfdfe fix: remove extraneous f-string prefixes in Python example
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-07 03:17:29 -07:00
Abir Taheer a9977af2c1 docs: add session.update() examples for TypeScript and Python
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-05-07 02:28:10 -07:00
Dhawal Upadhyay 98569bcf6f Respect base URL in Python ToolRouter examples 2026-05-06 18:52:18 +05:30
Dhawal Upadhyay eae717ac20 Clean up inline custom tools payload typing 2026-05-06 18:44:40 +05:30
Dhawal Upadhyay 8254999914 Address ToolRouter example review comments 2026-05-06 18:28:44 +05:30
Dhawal Upadhyay 9ad5705661 Add Tool Router preload examples 2026-05-06 16:35:33 +05:30
Musthaq Ahamad 27ed0c9bd6 security(core): sensitive path blocklist + beforeFileUpload hook (patch) (#3262)
## Summary

Security-hardening for automatic file upload in `@composio/core` (patch
release per changeset).

### Changes
- **Default denylist** for local paths before auto-upload /
`files.upload`: blocks common credential directories (e.g. `.ssh`,
`.aws`) and credential-like filenames (e.g. `.env`, default SSH private
keys). Resolves symlinks when the path exists.
- **Config:** `sensitiveFileUploadProtection`,
`fileUploadPathDenySegments` on `Composio`.
- **`beforeFileUpload`** hook (e.g. with `composio.tools.get` /
`tools.execute`): rewrite path, return `false` to abort, or throw.
- **Errors:** `ComposioSensitiveFilePathBlockedError`,
`ComposioFileUploadAbortedError`; file modifier errors exported from
`@composio/core` errors entry.
- **Changeset:** patch bump for `@composio/core`.

### Notes
- URLs and `File` blobs are not subject to the path denylist
(unchanged).
- Opt out of path checks only if required:
`sensitiveFileUploadProtection: false`.

### Tests
- `pnpm test` in `ts/packages/core` (799 tests) passed locally before
commit.

Made with [Cursor](https://cursor.com)
2026-04-23 18:42:16 +05:30
Dhawal Upadhyay d21e7e76f4 fix(python): address PR review comments
- Fix async validation bypass for single-param tools: check
  asyncio.iscoroutinefunction(fn) before wrapping in _infer_tool
- Remove inline # slug/name comments from example (jkomyno review)
- Add test for async single-param rejection

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:11:03 -07:00
Dhawal Upadhyay 81067dad81 style(python): clean up example file spacing
Single blank lines between definitions, noqa for E302/E303
since this is an example file not a library module.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:11:03 -07:00
Dhawal Upadhyay d1abe5df56 refactor(python): merge examples into one file, fix mypy shadowing
- Remove custom_tools_v2.py, keep single custom_tools_agent_test.py
- Add override examples (slug, name, description) with inline comments
- Add toolkit tool with overridden name
- Fix mypy: rename entry -> local_entry to avoid shadowing
  CustomToolsMapEntry from earlier loop

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:11:03 -07:00
Dhawal Upadhyay 4c9dcf60f7 fix(python): remove unused sys import in example
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:11:03 -07:00
Dhawal Upadhyay 4bc4476ba8 docs(python): update e2e examples to use decorator API
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:11:03 -07:00
Dhawal Upadhyay 60328a01dd test(python): add Gmail proxy + mixed all-paths to agent e2e test
6 scenarios: standalone, toolkit, mixed local, remote, Gmail proxy
(CREATE_DRAFT via ctx.proxy_execute), mixed all paths in one turn.
manage_connections=True, user_id=default throughout.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:11:03 -07:00
Dhawal Upadhyay e208f7db45 test(python): expand agent e2e test to cover all custom tool paths
5 test scenarios with real LLM agent loop (OpenAI Agents SDK):
- Standalone custom tool (GET_USER, local)
- Custom toolkit tool (SET_ROLE, local, ROLE_MANAGER namespace)
- Mixed local tools (GET_USER + SET_ROLE in single session)
- Remote Composio tool (weathermap, backend execution)
- Mixed local + remote (GET_USER local + weathermap remote)

All 5/5 pass end-to-end.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:11:03 -07:00
Dhawal Upadhyay 4940181bb3 test(python): add LLM agent e2e test for custom tools
Full agent loop using OpenAI Agents SDK with custom tools routing.
Verifies COMPOSIO_SEARCH_TOOLS discovers custom tools and
COMPOSIO_MULTI_EXECUTE_TOOL routes them in-process.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:11:03 -07:00
Dhawal Upadhyay 7f55651b37 fix(python): address codex review round 3 findings + add e2e example
- P1: Preserve SessionExecuteResponse model for remote execute (don't
  convert to dict — backward compatible for callers using attribute access)
- P2: Serialize Pydantic models in SessionContextImpl.execute remote path
  via _serialize_arguments() before sending to backend
- P2: Apply before_execute/after_execute modifiers around intercepted
  COMPOSIO_MULTI_EXECUTE_TOOL calls in custom tools routing path
- P2: Surface backend batch errors in mixed local/remote multi-execute
  (include remote batch error message instead of just tool failure count)
- Reject async execute handlers at factory level (asyncio.iscoroutinefunction)
- Add custom_tools_v2.py e2e example (equivalent of TS custom-tools.ts)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 14:11:03 -07:00
Musthaq Ahamad 40a7dae840 Experimental release for files in tool-router (#2876) 2026-03-13 16:32:13 +05:30
Musthaq Ahamad 2bccee8d55 feat(python): add file upload/download support and ToolRouterSession refactor (#2865) 2026-03-10 13:15:48 +05:30
jkomyno ee738a6b93 fix(py): cursorbot 2026-02-06 02:08:50 +04:00
Alberto Schiabel b28c2d7bb1 fix(core): support v1, v2, v3 in composio.triggers.verifyWebhooks (#2361)
Co-authored-by: jkomyno <12381818+jkomyno@users.noreply.github.com>
2026-01-13 13:06:03 +05:30
Musthaq Ahamad eeb296b9a8 Fix claude agent sdk (#2307) 2025-12-27 14:25:26 +05:30
Musthaq Ahamad a550aeb289 Chore: Move tool router out of experimental and remove depreacted mcp (#2267) 2025-12-13 12:58:09 +05:30
Musthaq Ahamad f97d191cc6 Add native tool execution support for tool router in python (#2266) 2025-12-12 22:17:10 +05:30
Musthaq Ahamad f0e67c435c Fix tool router types from latest API changes (#2227)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-12-05 15:50:46 +05:30
Musthaq Ahamad 9e002c5ca3 Tool Router API Integration (#2214)
Co-authored-by: jkomyno <12381818+jkomyno@users.noreply.github.com>
2025-12-04 15:31:09 +05:30
Musthaq Ahamad f88ab9936d Fix: Telemetry and request headers (#2134) 2025-10-31 17:27:21 +05:30
Karan Vaidya 1164158e36 Fix gemini provider (#1998) 2025-09-27 02:16:45 -07:00
Musthaq Ahamad 9a1b0e99a7 Feat: Experimental MCP and ToolRouter (#1985)
Co-authored-by: prateek <karnalprateek@gmail.com>
Co-authored-by: Prateek <prateek@composio.dev>
2025-09-26 19:18:13 +05:30
Siddharth Balyan 349538525e feat: update SDK installation instructions and enhance development scripts (#1779) 2025-07-21 23:46:05 -07:00
balyan.sid@gmail.com b5ef8dcc7f feat: update SDK installation instructions and enhance development scripts
- Changed the "dev" script to run build snippets before starting the documentation server.
- Added a new "dev:all" task in turbo.json for better dependency management.
- Updated installation commands in documentation to reflect the new version 0.8.0 for various Composio packages.
- Adjusted authentication snippets and examples for clarity and accuracy.
2025-07-22 12:15:26 +05:30
lingalarahul7 cea1b4881d feat: support custom connection data arg in execute proxy and tool (#1766) 2025-07-21 17:14:47 +05:30
angrybayblade b7d123fa76 fix: typing issues 2025-06-25 10:43:48 +05:30
angrybayblade edfadf1142 misc: move auth fields helpers to toolkits names 2025-06-18 17:48:08 +05:30
angrybayblade 26a1d56db2 feat: add telemetry on the python SDK 2025-06-17 16:55:19 +05:30
angrybayblade 204a7a26b0 feat: add support for creating triggers using user id 2025-06-17 15:12:00 +05:30
angrybayblade e6c3d3f063 chore: linters and formatting 2025-06-17 13:59:52 +05:30
angrybayblade 860b1c444a chore: port python sdk to python/ 2025-06-17 12:58:00 +05:30