LlamaIndex

The LlamaIndex provider turns Composio tools into LlamaIndex FunctionTool objects that execute themselves. You connect an account, fetch the tools, hand them to a FunctionAgent, and LlamaIndex drives the calls. The provider ships for both Python and TypeScript.

Install

uv add composio composio_llamaindex llama-index llama-index-llms-openai

Configure API Keys

Set COMPOSIO_API_KEY with your API key from Settings and OPENAI_API_KEY with your OpenAI API key.

.env
COMPOSIO_API_KEY=xxxxxxxxx
OPENAI_API_KEY=xxxxxxxxx

Create session and run

import asyncio
from composio import Composio
from composio_llamaindex import LlamaIndexProvider
from llama_index.core.agent.workflow import FunctionAgent
from llama_index.llms.openai import OpenAI

composio = Composio(provider=LlamaIndexProvider())
llm = OpenAI(model="gpt-5.2")

# Create a session for your user
session = composio.create(user_id="user_123")
tools = session.tools()

agent = FunctionAgent(tools=tools, llm=llm)

async def main():
    result = await agent.run(
        user_msg="Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'"
    )
    print(result)

asyncio.run(main())

TypeScript tool schemas

The TypeScript provider passes each tool's JSON Schema directly to the model, preserving keywords such as format, contentEncoding, and contentMediaType. Tool arguments are still validated before execution.

Next

What is a session?

How sessions scope users, tools, and auth, and how to reuse them across requests.