OpenAI Agents Provider

OpenAI Agents Provider

The OpenAI Agents Provider is a provider that formats the Composio tools into an object compatible with OpenAI’s Agents API.

OpenAI Agents SDK is different from the OpenAI SDK. It’s to help build agentic AI apps in a lightweight, easy-to-use package with very few abstractions.

Setup

$pip install composio[openai-agents] openai-agents

Usage

Python
1import asyncio
2
3from agents import Agent, Runner
4
5from composio import Composio
6from composio_openai_agents import OpenAIAgentsProvider
7
8# Initialize Composio toolset
9composio = Composio(provider=OpenAIAgentsProvider())
10
11# Get all the tools
12tools = composio.tools.get(
13 user_id="default",
14 tools=["GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER"],
15)
16
17# Create an agent with the tools
18agent = Agent(
19 name="GitHub Agent",
20 instructions="You are a helpful assistant.",
21 tools=tools,
22)
23
24# Run the agent
25async def main():
26 result = await Runner.run(
27 starting_agent=agent,
28 input=(
29 "Star the repository composiohq/composio on GitHub"
30 ),
31 )
32 print(result.final_output)
33
34asyncio.run(main())