Quickstart
π Prerequisites
π Setting Up Environment Variables
# OpenAI API Configuration
export MODEL_BASE_URL=https://api.openai.com/v1
export MODEL_API_KEY=your_openai_api_key
export MODEL_ID=gpt-4o # or any other model ID you preferπ Hello World Example
import asyncio
import os
from agentopera.chatflow.agents import AssistantAgent
from agentopera.models.openai import OpenAIChatCompletionClient
# Create a model client using the OpenAI API key and model ID
model_client = OpenAIChatCompletionClient(
base_url=os.getenv("MODEL_BASE_URL"),
api_key=os.getenv("MODEL_API_KEY"),
model=os.getenv("MODEL_ID")
)
async def main() -> None:
# Create an assistant agent using the model client
agent = AssistantAgent("assistant", model_client=model_client)
# Run the agent with the task "Say 'Hello World!'"
print(await agent.run(task="Say 'Hello World!'"))
asyncio.run(main())π Next Steps
π Acknowledgements
Last updated