Configuration
Configuration for Agents and Tasks
Peeps AI uses YAML files for configuring agents and tasks, making it easy to define roles, behaviors, and workflows in a structured, human-readable format. This approach decouples logic from code, enabling quick adjustments without altering the underlying Python scripts. In this guide, you’ll learn how to configure agents and tasks to bring your Peeps AI project to life.
Understanding YAML in Peeps AI
YAML (Yet Another Markup Language) is a lightweight data serialization format that Peeps AI uses to configure agents and tasks. It allows for clean, hierarchical definitions of components, ensuring clarity and ease of use.
Agents Configuration (
agents.yaml
): Specifies the roles, goals, and metadata for your AI agents.Tasks Configuration (
tasks.yaml
): Defines the tasks agents perform, including their descriptions, expected outputs, and associated agents.
Configuring Agents in agents.yaml
agents.yaml
Agents are the core entities in Peeps AI, responsible for carrying out specific roles within a project. The agents.yaml
file is where you define each agent’s purpose and attributes.
Example: Basic Agent Configuration
researcher:
role: "AI Researcher"
goal: "Conduct advanced market analysis"
backstory: "A seasoned researcher with expertise in data analysis and trend forecasting"
Key Elements:
role
: A concise description of the agent’s function.goal
: The primary objective the agent seeks to achieve.backstory
(optional): Additional context or metadata to enhance the agent’s persona.
Example: Adding Multiple Agents
researcher:
role: "AI Researcher"
goal: "Identify emerging trends in technology"
backstory: "An expert in uncovering cutting-edge developments"
analyst:
role: "Data Analyst"
goal: "Transform research findings into actionable insights"
backstory: "A meticulous analyst with a passion for data storytelling"
Configuring Tasks in tasks.yaml
tasks.yaml
Tasks represent the actions or workflows that agents must execute. The tasks.yaml
file defines each task’s description, expected outputs, and the agent assigned to it.
Example: Basic Task Configuration
market_research_task:
description: "Perform market research on the tech sector"
expected_output: "A list of 10 key trends and their implications"
agent: researcher
Key Elements:
description
: A detailed explanation of what the task involves.expected_output
: Specifies what the task should produce upon completion.agent
: The name of the agent responsible for the task (matches the key inagents.yaml
).
Example: Defining Multiple Tasks
market_research_task:
description: "Conduct in-depth research on the AI market"
expected_output: "A comprehensive summary of current trends and competitors"
agent: researcher
data_analysis_task:
description: "Analyze the research findings and create a report"
expected_output: "A detailed PDF report with actionable insights"
agent: analyst
Advanced Configurations
❖ Parameterized Tasks Tasks can include placeholders for dynamic inputs, allowing greater flexibility.
Example: Parameterized Task
parameterized_research_task:
description: "Research the market trends in {sector}"
expected_output: "A summary of key findings in the {sector} sector"
agent: researcher
When executing this task, you can provide the sector
value dynamically (e.g., "technology" or "finance").
❖ Task Dependencies
Tasks can be defined in a way that one depends on the output of another. While the dependencies are managed programmatically in group.py
, the task definitions can include hints.
Example: Task Dependency
data_validation_task:
description: "Validate the findings from the market research"
expected_output: "A list of verified trends and potential inaccuracies"
agent: analyst
❖ Tags for Categorization Add tags to group or filter tasks based on specific criteria.
Example: Categorized Tasks
competitor_analysis_task:
description: "Identify key competitors in the market"
expected_output: "A list of competitors with strengths and weaknesses"
agent: researcher
tags: ["analysis", "market_research"]
Best Practices for YAML Configuration
❖ Keep It Simple Start with basic configurations and add complexity as needed. Test individual agents and tasks before expanding.
❖ Use Descriptive Names Choose meaningful names for agents and tasks to improve readability and maintainability.
❖ Validate Syntax YAML files are sensitive to indentation and formatting. Use a linter or online validator to ensure correctness.
❖ Leverage Comments
Use comments (#
) to document configurations and provide context for future reference.
Example: Adding Comments
# Researcher agent focuses on uncovering trends
researcher:
role: "AI Researcher"
goal: "Analyze market data"
Testing Your Configurations
After defining agents and tasks in YAML, verify the configurations by running a test in your Peeps AI project:
❖ Load and print agents:
from peepsai import load_agents
agents = load_agents("config/agents.yaml")
print(agents)
❖ Check tasks by listing their details:
from peepsai import load_tasks
tasks = load_tasks("config/tasks.yaml")
print(tasks)
These simple tests ensure your configurations are correctly loaded and ready for execution.
Next Steps
With your agents and tasks configured, you’re ready to define the workflow logic in your group.py
file. Continue to the next section, “Customize Workflow Logic,” to learn how to orchestrate tasks and agents effectively.
Last updated