Quickstart
Execute your first tool from Composio
This guide demonstrates a core Composio feature, executing authenticated tool calls without wrapping complex API calls into LLM tools yourself.
We’ll connect to GitHub and fetch your username using a simple script.
Setup
First, let’s get your environment ready. You only need to do this once.
This command will open a browser window for you to authenticate and generate your API key.
Make sure to set the retrieved COMPOSIO_API_KEY
as an environment variable in your development environment (e.g., in a .env
file or by exporting it).
Composio handles the OAuth flow. This command links your GitHub account to your default Composio Entity (user profile).
Follow the prompts in your terminal and browser to authorize Composio.
With setup done, let’s write the code.
Tool-calling with Composio
The code below shows how to give tools to an LLM and letting Composio handle the execution when the LLM decides to use a tool.
After running the script, you should see your GitHub username printed!
What just happened?
- Tool Discovery: You asked Composio for tools (toolset.get_tools). Composio provided LLM-ready definitions for GitHub actions.
- LLM Reasoning: The LLM received your task (“Get my GitHub username”) and the available tools. It determined the
GITHUB_GET_THE_AUTHENTICATED_USER
tool was appropriate. - Tool Request: The LLM responded asking to call that specific tool.
- Composio Execution:
toolset.handle_tool_calls
intercepted this request. It found your linked GitHub credentials, made the actual API call, and returned the result.
You focused on the prompt and handling the final outcome, while Composio managed the tool schemas, authentication, and API interaction.