A workflow optimization pattern where agents handle repetitive tasks through automated loops, processing multiple instances efficiently while maintaining consistency.

Quick Start

1

Install Package

First, install the PraisonAI Agents package:

pip install praisonaiagents
2

Set API Key

Set your OpenAI API key as an environment variable in your terminal:

export OPENAI_API_KEY=your_api_key_here
3

Create a file

Create a new file repetitive_agent.py with the basic setup:

from praisonaiagents import Agent, Task, PraisonAIAgents

agent = Agent(
    instructions="You are a loop agent that creating a loop of tasks."
)

task = Task(
    description="Create the list of tasks to be looped through.",
    agent=agent,
    task_type="loop",
    input_file="tasks.csv"
)

agents = PraisonAIAgents(
    agents=[agent],
    tasks=[task],
    process="workflow",
    max_iter=30
)

agents.start()
4

Start Agents

Type this in your terminal to run your agents:

python repetitive_agent.py

Requirements

  • Python 3.10 or higher
  • OpenAI API key. Generate OpenAI API key here. Use Other models using this guide.

Understanding Repetitive Agents

What are Repetitive Agents?

Repetitive agents enable:

  • Automated task loops
  • Batch processing
  • Consistent task execution
  • Efficient handling of multiple similar tasks

Features

Task Looping

Process multiple tasks through automated loops.

Batch Processing

Handle multiple similar tasks efficiently.

Input Management

Process tasks from structured input files.

Progress Tracking

Monitor task completion and progress.

Troubleshooting

Loop Issues

If loops aren’t working as expected:

  • Verify input file format
  • Check task configurations
  • Enable verbose mode for debugging

Performance Issues

If processing is slow:

  • Check batch sizes
  • Verify resource allocation
  • Monitor memory usage

Next Steps

For optimal results, ensure your input files are properly formatted and your task configurations are appropriate for your use case.

Was this page helpful?