Documentation Index Fetch the complete documentation index at: https://mintlify.com/composiohq/composio/llms.txt
Use this file to discover all available pages before exploring further.
Installation
Install the Composio TypeScript SDK using your preferred package manager:
npm install @composio/core
Requirements
Node.js : Version 16 or higher
TypeScript : Version 4.5 or higher (optional, but recommended)
Environment Setup
Get your API key
Sign up at composio.dev and obtain your API key from the dashboard.
Configure environment variables
Create a .env file in your project root and add your API key: COMPOSIO_API_KEY = your-api-key-here
COMPOSIO_BASE_URL = https://backend.composio.dev/api # Optional: Custom API base URL
COMPOSIO_LOG_LEVEL = info # Optional: silent, error, warn, info, debug
COMPOSIO_DISABLE_TELEMETRY = false # Optional: Set to "true" to disable telemetry
Initialize the SDK
Import and initialize the Composio SDK in your application: import { Composio } from '@composio/core' ;
const composio = new Composio ({
apiKey: process . env . COMPOSIO_API_KEY ,
});
Verification
Verify your installation by running a simple test:
import { Composio } from '@composio/core' ;
const composio = new Composio ({
apiKey: process . env . COMPOSIO_API_KEY ,
});
// Test the connection
async function verify () {
try {
const userId = 'test-user' ;
const tools = await composio . tools . get ( userId , {
toolkits: [ 'HACKERNEWS' ],
});
console . log ( `Successfully connected! Found ${ tools . length } tools.` );
} catch ( error ) {
console . error ( 'Connection failed:' , error );
}
}
verify ();
Provider-Specific Packages
Depending on your AI framework, you may want to install a provider-specific package:
OpenAI
OpenAI Agents
Anthropic
LangChain
LlamaIndex
Vercel AI SDK
Google Gemini
Mastra
Cloudflare Workers AI
npm install @composio/openai
Quick Start Example
Here’s a complete example using OpenAI Agents:
Install dependencies
npm install @composio/openai-agents @openai/agents
Create your agent
import { Composio } from '@composio/core' ;
import { OpenAIAgentsProvider } from '@composio/openai-agents' ;
import { Agent , run } from '@openai/agents' ;
const composio = new Composio ({
provider: new OpenAIAgentsProvider (),
});
const userId = 'user@acme.org' ;
const tools = await composio . tools . get ( userId , {
toolkits: [ 'HACKERNEWS' ],
});
const agent = new Agent ({
name: 'Hackernews assistant' ,
tools: tools ,
});
const result = await run ( agent , 'What is the latest hackernews post about?' );
console . log ( JSON . stringify ( result . finalOutput , null , 2 ));
Next Steps