import { Composio } from '@composio/core';import { OpenAIAgentsProvider } from '@composio/openai-agents';import { Agent, run } from '@openai/agents';const composio = new Composio({ provider: new OpenAIAgentsProvider(),});const userId = 'user@acme.org';
const agent = new Agent({ name: 'Hackernews assistant', tools: tools,});const result = await run(agent, 'What is the latest hackernews post about?');console.log(JSON.stringify(result.finalOutput, null, 2));// will return the response from the agent with data from HACKERNEWS API.
# Create an agent with the toolsagent = Agent( name="Hackernews Agent", instructions="You are a helpful assistant.", tools=tools,)# Run the agentasync def main(): result = await Runner.run( starting_agent=agent, input="What's the latest Hackernews post about?", ) print(result.final_output)asyncio.run(main())# will return the response from the agent with data from HACKERNEWS API.
import { Composio } from '@composio/core';import { OpenAIAgentsProvider } from '@composio/openai-agents';import { Agent, run } from '@openai/agents';const composio = new Composio({ provider: new OpenAIAgentsProvider(),});const userId = 'user@acme.org';const tools = await composio.tools.get(userId, { toolkits: ['HACKERNEWS'],});const agent = new Agent({ name: 'Hackernews assistant', tools: tools,});const result = await run(agent, 'What is the latest hackernews post about?');console.log(JSON.stringify(result.finalOutput, null, 2));// will return the response from the agent with data from HACKERNEWS API.
import asynciofrom agents import Agent, Runnerfrom composio import Composiofrom composio_openai_agents import OpenAIAgentsProvider# Initialize Composio client with OpenAI Agents Providercomposio = Composio(provider=OpenAIAgentsProvider())user_id = "user@acme.org"tools = composio.tools.get(user_id=user_id, toolkits=["HACKERNEWS"])# Create an agent with the toolsagent = Agent( name="Hackernews Agent", instructions="You are a helpful assistant.", tools=tools,)# Run the agentasync def main(): result = await Runner.run( starting_agent=agent, input="What's the latest Hackernews post about?", ) print(result.final_output)asyncio.run(main())# will return the response from the agent with data from HACKERNEWS API.