Documentation Index
Fetch the complete documentation index at: https://docs.evo-ai.co/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Loop Agent is a type of workflow agent that executes sub-agents in an iterative cycle until a stop condition is met. This pattern is ideal for processes that need continuous refinement, iterative improvement, or multiple attempts until achieving a satisfactory result. Unlike Sequential and Parallel agents, the Loop Agent repeats the execution of sub-agents multiple times, allowing each iteration to improve the result based on feedback from the previous iteration.Key Features
Iterative Execution
Continuous Improvement
exit_loop Tool
Full Flexibility
exit_loop Tool - Stop Control
exit_loop tool. During sub-agent configuration, you define which ones have the power to stop the loop.- In each sub-agent configuration, you can enable the use of the
exit_looptool - Only selected sub-agents can decide to stop the loop
- The tool accepts parameters to document the reason for stopping
- Allows granular control over who can finalize the iterative process
- ✅ Sub-agents with exit_loop: Can use the tool to stop the loop
- ❌ Sub-agents without exit_loop: Execute normally without stopping power
exit_loop function accepts no arguments. It simply signals that the loop should stop.
Output Keys - State Sharing
loop_output will be used to generate the final response presented to the user at the end of the loop.- LLM Agent: Saves language model response
- Task Agent: Saves task execution result
- Workflow Agent: Saves executed workflow result
- A2A Agent: Saves Agent-to-Agent protocol response
loop_output:
- ⭐
loop_output- Sub-agent that generates final response presented to user - This agent is executed after all iterations to consolidate result
- This agent’s response is presented to the user as the final result
- Only one sub-agent can have
loop_outputas output_key
- Configure the Output Key of each sub-agent
- The result is automatically saved in the loop state
- Use placeholders
{{output_key_name}}in instructions to access data - State persists across all loop iterations
- At the end, the agent with
loop_outputconsolidates the final response
When to Use Loop Agent
Ideal Scenarios
Ideal Scenarios
- Iterative refinement: Improve result with each attempt
- Optimization: Seek best solution through iterations
- Validation with retry: Try until achieving valid result
- Incremental learning: Improve based on feedback
- Convergence: Iterate until reaching quality criteria
- Content refinement until desired quality is achieved
- Parameter optimization through trials
- Code generation with iterative corrections
- Multi-round negotiation
- Analysis with feedback-based refinement
When NOT to use
When NOT to use
- Single result: Process only needs to execute once
- No possible improvement: Iterations don’t add value
- Limited resources: Multiple executions are too costly
- Time critical: No time for multiple attempts
- Deterministic: Result will always be the same
Creating a Loop Agent
Step-by-Step on the Platform
1. Start creation
1. Start creation
- On the Evo AI main screen, click “New Agent”
- In the “Type” field, select “Loop Agent”
- You’ll see specific fields for loop configuration

2. Configure basic information
2. Configure basic information
3. Configure loop sub-agents
3. Configure loop sub-agents
exit_loop tool🎯 Final Response: One sub-agent must have output_key: "loop_output" to generate final responseContent refinement example:- Content Generator - Creates or refines content
- Quality Analyzer - Evaluates content quality
- Feedback Collector - Identifies improvement points
- Criteria Checker - Decides whether to continue (🛑 can use exit_loop)
- Finalizer - Generates final response (🎯 output_key: “loop_output”)

4. Define coordination instructions
4. Define coordination instructions
5. Configure sub-agent Output Keys
5. Configure sub-agent Output Keys
- ✅ LLM Agent - Saves model response to state
- ✅ Task Agent - Saves task result to state
- ✅ Workflow Agent - Saves workflow result to state
- ✅ A2A Agent - Saves A2A protocol response to state
- ⭐
loop_output- Sub-agent that generates final response presented to user

6. Configure loop stop control
6. Configure loop stop control
exit_loop Tool:During sub-agent configuration, you select which ones can use the exit_loop tool. Only enabled sub-agents have the power to stop the loop.Configuration in interface:
Practical Examples
1. Marketing Content Refinement
Loop Structure
Loop Structure
- Name:
content_generator - Description:
Generates or refines content based on feedback - Instructions:
- Output Key:
current_content
- Name:
quality_analyzer - Description:
Evaluates content quality across multiple dimensions - Instructions:
- Output Key:
quality_analysis
- Name:
feedback_collector - Description:
Identifies specific improvements based on analysis - Instructions:
- Output Key:
improvement_feedback
- Name:
criteria_checker - Description:
Decides whether to continue iterating or use exit_loop - ✅ Can use exit_loop: Enabled
- Instructions:
- Output Key:
stop_decision
- Name:
final_consolidator - Description:
Generates consolidated final response for user - ✅ Can use exit_loop: Disabled (executes after loop)
- Instructions:
- Output Key:
loop_output⭐
2. Optimization with Different Agent Types
Loop Structure
Loop Structure
- Type:
LLM Agent - Description: Adjusts parameters based on previous performance
- Instructions:
Analyze request {{user_input}} and previous performance: {{previous_performance}}. Adjust parameters to improve results. - Output Key:
current_parameters
- Type:
Task Agent - Description: Executes simulation with new parameters
- Task: Campaign simulation with parameters in
{{current_parameters}} - Output Key:
simulated_performance
- Type:
A2A Agent - Description: Analyzes data via external protocol
- Endpoint: Analysis system that receives
{{simulated_performance}} - Output Key:
detailed_analysis
- Type:
LLM Agent - Description: Decides if satisfactory optimization achieved
- ✅ Can use exit_loop: Enabled
- Instructions:
Based on analysis {{detailed_analysis}}, if improvement < 5% use exit_loop. - Output Key:
optimization_decision
- Type:
LLM Agent - Description: Generates final response with optimized parameters
- ✅ Can use exit_loop: Disabled
- Instructions:
Based on complete optimization {{current_parameters}} and {{detailed_analysis}}, present final result for {{user_input}}. - Output Key:
loop_output⭐
3. Development with Workflow Agents
Loop Structure
Loop Structure
- Type:
LLM Agent - Description: Generates or fixes code based on requirements
- Instructions:
Based on request {{user_input}}, generate code for: {{requirements}}. If there are errors in {{test_results}}, fix them. - Output Key:
current_code
- Type:
Workflow Agent(Sequential) - Description: Executes complete testing pipeline
- Sub-agents: [syntax_validator, test_executor, coverage_analyzer]
- Output Key:
test_results
- Type:
A2A Agent - Description: Analyzes quality via external system
- Endpoint: Code analysis system that receives
{{current_code}} - Output Key:
quality_analysis
- Type:
LLM Agent - Description: Decides if code is ready
- ✅ Can use exit_loop: Enabled
- Instructions:
Analyze results {{test_results}} and quality {{quality_analysis}}. If all tests passed and quality >= 8, use exit_loop. - Output Key:
final_check
- Type:
LLM Agent - Description: Delivers final code to user
- ✅ Can use exit_loop: Disabled
- Instructions:
Present final code {{current_code}} with documentation based on {{test_results}} and {{quality_analysis}} for {{user_input}}. - Output Key:
loop_output⭐
Advanced Loop Configurations
Output Keys - Shared State
Output Key Configuration
Output Key Configuration
Data Flow Between Agents
Data Flow Between Agents
- Use
{{code}}to access previous agent result - Use
{{tests}}to access test results - Use
{{requirements}}to access initial data - All data persists between iterations
Output Keys Best Practices
Output Keys Best Practices
- Use snake_case:
analysis_result,processed_data - Be descriptive:
quality_feedbackinstead offeedback - Avoid conflicts: don’t use names already existing in state
- Keep data structured when possible
- Use JSON for complex data
- Document expected format in instructions
- Avoid saving unnecessarily large data
- Clean temporary data when no longer needed
- Use output_key only when data will be reused
Stop Control with exit_loop
How to use exit_loop tool
How to use exit_loop tool
Time Control
Time Control
Convergence Monitoring
Convergence Monitoring
- Detects improvement trends
- Identifies performance plateaus
- Predicts required number of iterations
- Suggests parameter adjustments
Optimization Strategies
Loop Performance
Loop Performance
Memory Management
Memory Management
Monitoring and Debugging
Tracking Iterations
Loop Dashboard
Loop Dashboard
Loop Debugging
Loop Debugging
Best Practices
Effective Loop Design
Effective Loop Design
- Quality feedback: Each iteration should provide specific and actionable feedback
- Clear criteria with exit_loop: Define in instructions when to use exit_loop
- Multiple stop conditions: Implement various conditions with exit_loop
- Progress monitoring: Track improvement metrics
- Regression validation: Prevent iterations from worsening result
- Stop documentation: Use reason parameter to explain why it stopped
Convergence Optimization
Convergence Optimization
- Incremental feedback: Focus on one improvement at a time
- Prioritization: Address most impactful problems first
- Adaptive learning: Adjust strategy based on progress
- Early stopping: Stop when marginal improvement is low
- Quality gates: Validate minimum quality each iteration
Robustness and Reliability
Robustness and Reliability
- Error handling: Handle sub-agent failures gracefully
- State persistence: Save state between iterations
- Recovery mechanisms: Allow restart from failure points
- Resource management: Monitor CPU, memory and time usage
- Circuit breakers: Prevent failure cascades
Common Use Cases
Content Creation
- Text improvement until desired quality
- Copy optimization for conversion
- Commercial proposal refinement
Optimization
- Marketing campaign tuning
- Price optimization
- System configuration adjustment
Development
- Code generation with iterative testing
- Algorithm refinement
- Automatic bug fixing
Negotiation
- Automatic contract negotiation
- Proposal refinement
- Commercial terms optimization
Next Steps
Sequential Agent
Parallel Agent
LLM Agent
Configurations
The Loop Agent is perfect for processes that need continuous refinement and iterative improvement. Use it when you want to achieve high quality through multiple attempts and constant feedback.