This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is the Composio SDK v3 repository containing both TypeScript and Python SDKs. The main development focus is on the TypeScript SDK located in /ts/ directory. The project uses a monorepo structure with multiple packages and examples.
- For documentation tasks, refer to
docs/CLAUDE.md
The CLI package (@composio/cli) is built on the Effect.ts ecosystem. A local copy of the Effect source code is available as a git submodule:
- Location:
ts/vendor/effect/ - Repo: Effect-TS/effect
- Branch:
main
When working on CLI code, reference the Effect source for accurate patterns:
ts/vendor/effect/packages/effect/src/— core Effect runtimets/vendor/effect/packages/cli/src/— @effect/cli (Command, Options, Args)ts/vendor/effect/packages/platform/src/— @effect/platform (FileSystem, Terminal)
Important: The submodule is for read-only reference only. Do not modify files in ts/vendor/. The CLI's actual dependencies come from npm via pnpm install.
The CLI uses @clack/prompts for interactive terminal UI. A local copy of the Clack source code is available as a git submodule:
- Location:
ts/vendor/clack/ - Repo: bombshell-dev/clack
When working on CLI prompts and terminal UI, reference the Clack source for accurate APIs:
ts/vendor/clack/packages/prompts/src/—@clack/prompts(high-level API: text, select, confirm, spinner, etc.)ts/vendor/clack/packages/core/src/—@clack/core(low-level primitives)
See ts/packages/cli/AGENTS.md for detailed Clack usage guidelines.
Important: The submodule is for read-only reference only. Do not modify files in ts/vendor/. The CLI's actual @clack/prompts dependency comes from npm via pnpm install.
# Build all packages
pnpm build
# Build only TypeScript packages
pnpm build:packages
# Clean build artifacts
pnpm clean
pnpm clean:workspace
# Lint code
pnpm lint
pnpm lint:fix
# Format code
pnpm format
# Run tests
pnpm test# Install dependencies
pnpm install
# Check peer dependencies
pnpm check:peer-deps
# Update peer dependencies
pnpm update:peer-deps# Create a new provider
pnpm create:provider <provider-name> [--agentic]
# Create a new example
pnpm create:example <example-name># Create changeset for releases
pnpm changeset
# Version packages
pnpm changeset:version
# Publish packages
pnpm changeset:releasecomposio/
├── ts/ # TypeScript SDK (main development)
│ ├── packages/
│ │ ├── core/ # Core SDK functionality
│ │ ├── providers/ # AI provider integrations (OpenAI, Anthropic, etc.)
│ │ ├── cli/ # Command-line interface
│ │ ├── json-schema-to-zod/ # Schema conversion utility
│ │ └── ts-builders/ # TypeScript code generation utilities
│ └── examples/ # Usage examples for different providers
├── python/ # Python SDK
├── docs/ # Documentation (Fumadocs)
└── examples/ # Cross-platform examples
@composio/core - Main SDK functionality:
src/composio.ts- Main Composio classsrc/models/- Core models (Tools, Toolkits, ConnectedAccounts, etc.)src/provider/- Base provider implementationssrc/services/- Internal services (telemetry, pusher)src/types/- TypeScript type definitionssrc/utils/- Utility functions and helpers
Provider Packages - AI integrations:
@composio/openai- OpenAI integration@composio/anthropic- Anthropic integration@composio/google- Google GenAI integration@composio/langchain- LangChain integration@composio/vercel- Vercel AI integration@composio/mastra- Mastra integration
Tools - Individual functions that can be executed (e.g., GITHUB_CREATE_REPO, GMAIL_SEND_EMAIL)
Toolkits - Collections of related tools grouped by service (e.g., github, gmail, slack)
Connected Accounts - User authentication/authorization for external services
Auth Configs - Configuration for different authentication methods
Custom Tools - User-defined tools with custom logic
Providers - Integrations with AI frameworks (OpenAI, Anthropic, etc.)
Modifiers - Middleware to transform tool inputs/outputs
- Tools are auto-generated from OpenAPI specifications
- Custom tools can be created using the Custom Tools API
- Tool execution happens through the main Composio class
- Use
pnpm create:provider <name>to scaffold new providers - Implement required methods:
wrapTool,wrapTools - For agentic providers, also implement execution handlers
- Add comprehensive tests and documentation
- Unit tests use Vitest
- Run tests with
pnpm test - Tests are located in
test/directories within each package - Mock implementations are available in
test/utils/mocks/
- ESLint configuration in
eslint.config.mjs - Prettier for code formatting
- TypeScript strict mode enabled
- Comprehensive TSDoc documentation required
- Husky pre-commit hooks for quality checks
COMPOSIO_API_KEY # Required: Your Composio API key
COMPOSIO_BASE_URL # Optional: Custom API base URL
COMPOSIO_LOG_LEVEL # Optional: Logging level (silent, error, warn, info, debug)
COMPOSIO_DISABLE_TELEMETRY # Optional: Set to "true" to disable telemetry
DEVELOPMENT # Development mode flag
CI # CI environment flag- Main SDK Entry:
ts/packages/core/src/index.ts - Core Composio Class:
ts/packages/core/src/composio.ts - Type Definitions:
ts/packages/core/src/types/ - Error Classes:
ts/packages/core/src/errors/ - Examples:
ts/examples/andexamples/ - Documentation:
docs/ - Build Configs:
turbo.jsonc,tsconfig.base.json,tsdown.config.base.ts - E2E Tests:
ts/e2e-tests/
When modifying files in .github/workflows/, update the "Prerequisites" section in ts/docs/internal/release.md with the current tool versions:
- Node.js:
cat .nvmrc - Bun:
cat .bun-version - pnpm:
cat package.json | jq -r .packageManager | cut -d'@' -f2
# Run all tests
pnpm test
# Run tests for core package only
cd ts/packages/core && pnpm test
# Run tests with UI
pnpm test:uiE2E tests for @composio/core are located in ts/e2e-tests/ and test runtime compatibility across different JavaScript environments.
# Run all e2e tests (Node.js + Deno + Cloudflare)
pnpm test:e2e
# Run only Node.js e2e tests (CJS/ESM compatibility, runs in Docker)
pnpm test:e2e:node
# Run only Deno e2e tests (npm: specifier compatibility, runs in Docker)
pnpm test:e2e:deno
# Run only Cloudflare Workers e2e tests
pnpm test:e2e:cloudflare
# Run Node.js tests with a specific Node version
COMPOSIO_E2E_NODE_VERSION=22.12.0 pnpm test:e2e:node
# Run Deno tests with a specific Deno version
COMPOSIO_E2E_DENO_VERSION=2.6.7 pnpm test:e2e:denoE2E Test Structure:
ts/e2e-tests/
├── _utils/ # Shared Docker infrastructure
├── runtimes/
│ ├── node/ # Node.js runtime tests
│ │ ├── cjs-basic/ # CommonJS compatibility
│ │ └── esm-basic/ # ESM compatibility
│ ├── deno/ # Deno runtime tests
│ │ └── esm-basic/ # npm: specifier compatibility
│ └── cloudflare/ # Cloudflare runtime tests
│ └── cf-workers-basic/ # Cloudflare Workers tests
└── README.md # E2E test documentation
Note: When adding new e2e tests, update
ts/e2e-tests/README.mdwith the new test information.
const composio = new Composio({ apiKey: 'your-key' });
const result = await composio.tools.execute('TOOL_NAME', {
userId: 'user-id',
arguments: { /* tool args */ }
});import { OpenAIProvider } from '@composio/openai';
const provider = new OpenAIProvider({ apiKey: 'openai-key' });
const tools = await composio.tools.get('user-id', { toolkits: ['github'] });
const wrappedTools = provider.wrapTools(tools);import { z } from 'zod';
const customTool = await composio.tools.createCustomTool({
name: 'My Tool',
description: 'Tool description',
slug: 'MY_TOOL',
inputParams: z.object({
param: z.string().describe('Parameter description')
}),
execute: async (input) => {
// Implementation
return {
data: { result: input.param },
error: null,
successful: true
};
}
});This monorepo uses pnpm workspaces and Turbo for efficient builds and development.
The Python SDK is located in the /python/ directory and uses uv for dependency management and nox for automation.
# Create and setup Python development environment
cd python
make env
source .venv/bin/activate# Setup environment (creates virtual env with all dependencies)
make env
# Sync dependencies (when in an existing environment)
make sync
# Install provider packages
make provider
# Format code using ruff
make fmt
# Or directly: nox -s fmt
# Check linting and type issues
make chk
# Or directly: nox -s chk
# Fix linting issues
nox -s fix
# Run tests (requires implementing tst session)
make tst
# Or directly: nox -s tst
# Run sanity tests (requires implementing snt session)
make snt
# Or directly: nox -s snt
# Clean build artifacts
make clean-build
# Bump version
make bump
# Build packages
make buildpython/
├── composio/ # Main SDK package
├── providers/ # Provider implementations
├── tests/ # Test suite
├── examples/ # Usage examples
├── scripts/ # Development scripts
├── config/ # Configuration files
│ ├── pytest.ini # Pytest configuration
│ ├── mypy.ini # MyPy type checking config
│ ├── ruff.toml # Ruff linter/formatter config
│ └── codecov.yml # Code coverage config
├── Makefile # Development shortcuts
├── noxfile.py # Nox automation sessions
└── pyproject.toml # Project configuration
- Formatter: Ruff (Black-compatible, 88 char line length)
- Linter: Ruff with custom configuration
- Type Checker: mypy with strict optional typing
- Test Framework: pytest with custom markers (core, openai, langchain, agno)
- Python Version: >=3.10, <4
- Dependency Managers: uv
# Run tests with pytest markers
pytest -m core # Run core tests only
pytest -m openai # Run OpenAI provider tests
pytest -m langchain # Run LangChain provider tests
pytest -m agno # Run Agno provider tests- Core:
pysher,pydantic>=2.6.4,composio-client==1.4.0,typing-extensions>=4.0.0,openai - Dev:
nox,pytest,ruff,langchain_openai,fastapi,twine,click,semver
Same as TypeScript SDK, with additional:
OPENAI_API_KEY # Required for OpenAI provider examples