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 | import os |
| 2 | |
| 3 | from composio import Composio |
| 4 | |
| 5 | composio = Composio() |
| 6 | |
| 7 | # Connected account with GitHub access (raises KeyError when unset) |
| 8 | github_connected_account_id = os.environ[ |
| 9 | "COMPOSIO_EXAMPLES_GITHUB_CONNECTED_ACCOUNT_ID" |
| 10 | ] |
| 11 | |
| 12 | # Get all tools by toolkit |
| 13 | tools = composio.tools.get(user_id="default", toolkits=["GITHUB"]) |
| 14 | |
| 15 | # Get all tools by search |
| 16 | tools = composio.tools.get(user_id="default", search="user") |
| 17 | |
| 18 | # Get all tools by toolkit and search |
| 19 | tools = composio.tools.get(user_id="default", toolkits=["GITHUB"], search="star") |
| 20 | |
| 21 | # execute tool |
| 22 | response = composio.tools.execute( |
| 23 | user_id="default", |
| 24 | slug="HACKERNEWS_GET_USER", |
| 25 | arguments={"username": "pg"}, |
| 26 | version="20251023_00", |
| 27 | ) |
| 28 | print(response) |
| 29 | |
| 30 | # execute proxy call (github) |
| 31 | proxy_response = composio.tools.proxy( |
| 32 | endpoint="/repos/composiohq/composio/issues/1", |
| 33 | method="GET", |
| 34 | connected_account_id=github_connected_account_id, # use connected account for github |
| 35 | parameters=[ |
| 36 | { |
| 37 | "name": "Accept", |
| 38 | "value": "application/vnd.github.v3+json", |
| 39 | "type": "header", |
| 40 | }, |
| 41 | ], |
| 42 | ) |
| 43 | print(proxy_response) |