Creating an Agent
Use the@agent decorator to define an agent class:
Agent Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
name | str | required | Unique agent identifier |
description | str | None | Human-readable description |
system_prompt | str | None | Base system prompt |
llm_config | dict | defaults | Model, temperature, max_tokens |
enable_planning | bool | True | Enable multi-step planning |
enable_reflection | bool | True | Enable self-reflection on outputs |
enable_retrieval | bool | False | Enable knowledge base retrieval |
max_turns | int | 10 | Maximum LLM call iterations |
Agent Capabilities
Planning
When enabled, the agent breaks complex tasks into steps before execution. Configure viaPlanningConfig:
Reflection
The agent reviews its own output and retries if quality is insufficient. Controlled bymax_reflection_attempts.
Retrieval
Automatically searches attached knowledge bases for relevant context before responding.The Execution Loop
max_turns is reached.
Built-In Agents
AgentFlow ships with several pre-configured agents:| Agent | Role |
|---|---|
MainAgent | Primary orchestrator — routes to sub-agents |
EmailsAgent | Email read, write, and management |
TasksAgent | Task creation and tracking |
MeetingsAgent | Calendar and meeting management |
RecordsAgent | CRM record operations |
ResearchAgent | Web search and company research |
GeneralSubAgent | Autonomous work delegation |