@devries-cameron20 / composio Mirror · read-only
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 21, 06:00 UTC

next
md 48 lines 1.57 KB
Rendered Raw
1 # @composio/llamaindex
2
3 The LlamaIndex provider turns Composio tools into LlamaIndex tools that execute themselves, ready to hand to a LlamaIndex agent.
4
5 ## Installation
6
7 ```bash
8 npm install @composio/core @composio/llamaindex @llamaindex/openai @llamaindex/workflow
9 ```
10
11 Set `COMPOSIO_API_KEY` with your API key from [the dashboard](https://dashboard.composio.dev/settings), and `OPENAI_API_KEY` (or your LLM provider's key).
12
13 ## Quickstart
14
15 Create a session for your user, fetch its tools, and hand them to an agent:
16
17 ```typescript
18 import { Composio } from '@composio/core';
19 import { LlamaindexProvider } from '@composio/llamaindex';
20 import { openai } from '@llamaindex/openai';
21 import { agent } from '@llamaindex/workflow';
22
23 const composio = new Composio({
24 provider: new LlamaindexProvider(),
25 });
26
27 // Create a session for your user
28 const session = await composio.create('user_123');
29 const tools = await session.tools();
30
31 const myAgent = agent({
32 llm: openai({ model: 'gpt-5.2' }),
33 tools,
34 });
35
36 const result = await myAgent.run(
37 "Send an email to john@example.com with the subject 'Hello' and body 'Hello from Composio!'"
38 );
39
40 console.log(result.data.result);
41 ```
42
43 The provider gives LlamaIndex each tool's JSON Schema as the parameters the model sees, with internal `$ref`s inlined, and validates tool-call arguments with a Zod schema built from the same JSON Schema. Execution is wired through Composio, so LlamaIndex can call the tools directly.
44
45 ## Links
46
47 - [LlamaIndex provider docs](https://docs.composio.dev/docs/providers/llamaindex)
48 - [Composio documentation](https://docs.composio.dev)