from polos import (
Agent,
max_tokens,
MaxTokensConfig,
max_steps,
MaxStepsConfig,
executed_tool,
ExecutedToolConfig,
PolosClient
)
research_agent = Agent(
id="research-agent",
provider="openai",
model="gpt-4o",
system_prompt="Research the topic thoroughly.",
tools=[search_web, read_article],
stop_conditions=[
max_tokens(MaxTokensConfig(limit=10000)), # Stop at 10k tokens
max_steps(MaxStepsConfig(count=5)), # Stop after 5 steps
executed_tool(ExecutedToolConfig( # Stop after both get_weather and search_news are executed
tool_names=["get_weather", "search_news"]
)),
has_text(HasTextConfig(texts=["DONE"])) # Stop when the LLM response contains DONE
]
)
client = PolosClient()
response = await research_agent.run(
client,
"Research AI agents and write a comprehensive report"
)