Overview
Introduction to AI agents in Compozy - autonomous entities that reason, decide, and execute actions
What are Agents?
Agents in Compozy are autonomous AI-powered entities that can reason, make decisions, and execute actions based on natural language instructions. They serve as the intelligent core of Compozy workflows, orchestrating complex tasks through advanced language model capabilities.
Key Capabilities
Agents combine several powerful features to deliver intelligent automation:
Natural Language Understanding
Dynamic Decision Making
Tool Utilization
Iterative Problem Solving
Core Features
- 1LLM Integration
Connect to various AI providers including OpenAI, Anthropic, Google, and local models through a unified interface
- 2Action System
Define structured actions with input/output schemas for type-safe, predictable interactions
- 3Tool Access
Utilize external tools and APIs dynamically, from file operations to complex integrations
- 4MCP Support
Extend capabilities through Model Context Protocol servers for standardized tool interfaces
- 5Memory Management
Access shared context across workflow steps and maintain conversational state
- 6Iterative Execution
Allow agents to refine their responses through multiple reasoning iterations
Basic Agent Configuration
Here's a simple example of an agent configuration:
resource: agent
id: code-assistant
version: 0.1.0
config:
provider: anthropic
model: claude-4-opus
params:
temperature: 0.7
max_tokens: 4000
instructions: |
You are an expert software engineer specializing in code review.
Focus on clarity, performance, and best practices.
Always explain your reasoning and provide actionable feedback.
actions:
- id: review-code
prompt: "Analyze the provided code for quality and improvements"
input:
type: object
properties:
code:
type: string
description: "The code to review"
language:
type: string
enum: ["python", "go", "javascript"]
required: ["code", "language"]
json_mode: true
output:
type: object
properties:
issues:
type: array
items:
type: object
properties:
severity:
type: string
enum: ["critical", "high", "medium", "low"]
description:
type: string
How Agents Work
Initialization
Agent loads configuration including instructions, model settings, and available tools
Context Building
Gathers relevant context from workflow inputs, memory, and previous task outputs
Action Execution
Processes the specified action with the given inputs and constraints
Tool Usage
Dynamically decides when and how to use available tools to complete the task
Iteration
Refines response through multiple iterations if needed (up to max_iterations)
Output Generation
Produces structured output according to the action's schema
Agent Architecture
Use Cases
Agents excel in various scenarios:
Best Practices
- 1Be clear and specific
Define the agent's role explicitly to ensure consistent behavior
- 2Define boundaries
Set clear constraints on what the agent should and shouldn't do
- 3Include domain knowledge
Provide relevant context and expertise for better performance
- 4Use markdown structure
Format instructions with markdown for better readability
Related Documentation
Next Steps
Context Variables
Context variables provide access to data from various sources throughout your Compozy workflows. Understanding the context structure and data access patterns is essential for building dynamic, data-driven configurations.
LLM Integration
How agents integrate with various LLM providers through a unified interface