Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Python 3.10 or higher
- PraisonAI Agents package installed
- PraisonAI Tools package installed
pyyaml package installed
- Basic understanding of YAML format
Use YAML Tools to process and manipulate YAML files with AI agents.
Install Dependencies
First, install the required packages:pip install praisonaiagents praisonai-tools pyyaml
Import Components
Import the necessary components:from praisonaiagents import Agent, Task, AgentTeam
from praisonai_tools import read_yaml, write_yaml, validate_yaml, merge_yaml, convert_yaml
Create Agent
Create a YAML processing agent:yaml_agent = Agent(
name="YAMLProcessor",
role="YAML Processing Specialist",
goal="Process YAML files efficiently and accurately.",
backstory="Expert in YAML file manipulation and validation.",
tools=[read_yaml, write_yaml, validate_yaml, merge_yaml, convert_yaml],
reflection=False
)
Define Task
Define the YAML processing task:yaml_task = Task(
description="Parse and validate configuration files.",
expected_output="Validated and processed YAML configurations.",
agent=yaml_agent,
name="yaml_processing"
)
Run Agent
Initialize and run the agent:agents = AgentTeam(
agents=[yaml_agent],
tasks=[yaml_task],
process="sequential"
)
agents.start()
What are YAML Tools?
YAML Tools provide YAML processing capabilities for AI agents:
- Reading YAML files
- Writing YAML data
- Validating YAML structure
- Merging YAML files
- Converting between formats
Key Components
YAML Agent
Create specialized YAML agents:Agent(tools=[read_yaml, write_yaml, validate_yaml, merge_yaml, convert_yaml])
YAML Task
Define YAML tasks:Task(description="yaml_operation")
Process Types
Sequential or parallel processing: YAML Options
Customize YAML parameters:safe_load=True, encoding="utf-8"
Available Functions
from praisonai_tools import read_yaml
from praisonai_tools import write_yaml
from praisonai_tools import validate_yaml
from praisonai_tools import merge_yaml
from praisonai_tools import convert_yaml
Examples
Basic YAML Processing Agent
from praisonaiagents import Agent, Task, AgentTeam
from praisonai_tools import read_yaml, write_yaml, validate_yaml, merge_yaml, convert_yaml
# Create YAML agent
yaml_agent = Agent(
name="YAMLExpert",
role="YAML Processing Specialist",
goal="Process YAML files efficiently and accurately.",
backstory="Expert in YAML file handling and validation.",
tools=[read_yaml, write_yaml, validate_yaml, merge_yaml, convert_yaml],
reflection=False
)
# Define YAML task
yaml_task = Task(
description="Parse and validate configuration files.",
expected_output="Processed and validated YAML data.",
agent=yaml_agent,
name="config_processing"
)
# Run agent
agents = AgentTeam(
agents=[yaml_agent],
tasks=[yaml_task],
process="sequential"
)
agents.start()
Advanced YAML Processing with Multiple Agents
from praisonaiagents import Agent, Task, AgentTeam
from praisonai_tools import read_yaml, write_yaml, convert_yaml, validate_yaml, merge_yaml
# Create YAML processing agent
processor_agent = Agent(
name="Processor",
role="YAML Processor",
goal="Process YAML files systematically.",
tools=[read_yaml, write_yaml, convert_yaml],
reflection=False
)
# Create validation agent
validator_agent = Agent(
name="Validator",
role="Data Validator",
goal="Validate YAML structure and content.",
backstory="Expert in data validation and verification.",
tools=[validate_yaml, merge_yaml],
reflection=False
)
# Define tasks
processing_task = Task(
description="Process and transform YAML configurations.",
agent=processor_agent,
name="yaml_processing"
)
validation_task = Task(
description="Validate processed YAML data.",
agent=validator_agent,
name="data_validation"
)
# Run agents
agents = AgentTeam(
agents=[processor_agent, validator_agent],
tasks=[processing_task, validation_task],
process="sequential"
)
agents.start()
Best Practices
Configure agents with clear YAML focus:from praisonai_tools import read_yaml, write_yaml, validate_yaml, merge_yaml, convert_yaml
Agent(
name="YAMLProcessor",
role="YAML Processing Specialist",
goal="Process YAML files accurately and safely",
tools=[read_yaml, write_yaml, validate_yaml, merge_yaml, convert_yaml]
)
Define specific YAML operations:Task(
description="Parse and validate deployment configurations",
expected_output="Validated configuration set"
)
Common Patterns
YAML Processing Pipeline
from praisonaiagents import Agent, Task, AgentTeam
from praisonai_tools import read_yaml, write_yaml, convert_yaml, validate_yaml, merge_yaml
# Processing agent
processor = Agent(
name="Processor",
role="YAML Processor",
tools=[read_yaml, write_yaml, convert_yaml]
)
# Validation agent
validator = Agent(
name="Validator",
role="Data Validator",
tools=[validate_yaml, merge_yaml]
)
# Define tasks
process_task = Task(
description="Process YAML files",
agent=processor
)
validate_task = Task(
description="Validate processed data",
agent=validator
)
# Run workflow
agents = AgentTeam(
agents=[processor, validator],
tasks=[process_task, validate_task]
)