Documentation Index
Fetch the complete documentation index at: https://polos.dev/docs/llms.txt
Use this file to discover all available pages before exploring further.
A simple agent that uses a tool to look up weather information.
from pydantic import BaseModel
from polos import tool, WorkflowContext
class WeatherInput(BaseModel):
city: str
class WeatherOutput(BaseModel):
city: str
temperature: int
condition: str
@tool(description="Get weather for a city")
async def get_weather(ctx: WorkflowContext, input: WeatherInput) -> WeatherOutput:
# In production, call a real weather API
return WeatherOutput(city=input.city, temperature=72, condition="Sunny")
Create the agent
from polos import Agent, max_steps, MaxStepsConfig
weather_agent = Agent(
id="weather_agent",
provider="openai",
model="gpt-4o-mini",
system_prompt="You are a weather assistant. Use the get_weather tool to look up weather.",
tools=[get_weather],
stop_conditions=[max_steps(MaxStepsConfig(limit=10))],
)
Run it
git clone https://github.com/polos-dev/polos.git
cd polos/python-examples/01-weather-agent
cp .env.example .env # Add your POLOS_PROJECT_ID and OPENAI_API_KEY
uv sync
python main.py
Open http://localhost:5173 to view your agents and workflows, run them from the UI, and see execution traces.
Python example on GitHub | TypeScript example on GitHub