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, 03:37 UTC
| 1 | import asyncio |
| 2 | |
| 3 | from agents import Agent, Runner |
| 4 | from composio_openai_agents import OpenAIAgentsProvider |
| 5 | |
| 6 | from composio import Composio |
| 7 | |
| 8 | # Initialize Composio toolset |
| 9 | composio = Composio(provider=OpenAIAgentsProvider()) |
| 10 | |
| 11 | # Get all the tools |
| 12 | tools = 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 |
| 18 | agent = Agent( |
| 19 | name="GitHub Agent", |
| 20 | instructions="You are a helpful assistant that helps users with GitHub tasks.", |
| 21 | tools=tools, |
| 22 | ) |
| 23 | |
| 24 | |
| 25 | # Run the agent |
| 26 | async def main(): |
| 27 | result = await Runner.run( |
| 28 | starting_agent=agent, |
| 29 | input=( |
| 30 | "Star the repository composiohq/composio on GitHub. If done " |
| 31 | "successfully, respond with 'Action executed successfully'" |
| 32 | ), |
| 33 | ) |
| 34 | print(result.final_output) |
| 35 | |
| 36 | |
| 37 | asyncio.run(main()) |