Structure
Agents in Compozy follow a consistent structure:Basic Usage
Agents can be used in three main ways:Custom Settings
Each agent’s configuration can be overridden regardless of whether it’s an external package or local import. Useconfig to override provider settings and with to override agent-specific parameters:
Tools Integration
Agents can be equipped with tools to extend their capabilities and interact with external services. Tools are defined at the agent level:Best Practices
1
Agent Design
- Keep actions focused and single-purpose
- Write clear instructions
- Define comprehensive output schemas
2
Configuration
- Start with conservative temperature values
- Adjust max_tokens based on expected responses
- Use appropriate model versions
3
Tool Integration
- Only include necessary tools
- Configure tool timeouts and limits
- Test tool interactions thoroughly
4
Memory Management
- Configure memory when needed
- Clear state appropriately
- Consider persistence requirements
Using Agents in Tasks
Agents can be executed within tasks using the agent task type:- The agent’s output is available as the task output
- Task error handling and retry mechanisms apply to the agent execution
- Agent configuration can be overridden at the task level
- Multiple agent actions can be executed sequentially