Skip to main content

YAML Agent Configuration

Flo AI supports creating agents entirely through YAML configuration files, making it easy to version control, share, and manage agent configurations.

Basic YAML Agent

Create a simple agent using YAML:
agent.yaml
Load YAML Agent

Advanced YAML Configuration

Agent with Tools

Tools in YAML can be specified as string references (to tools in a tool registry) or as tool configurations with pre-filled parameters:
tool-agent.yaml

Agent with Structured Output

Use the parser field to define structured output schemas:
structured-agent.yaml

Agent with Role and Reasoning Pattern

advanced-agent.yaml

Agent with Examples

You can provide example input/output pairs to guide the agent:
example-agent.yaml

YAML Schema Reference

Metadata Section

Agent Configuration

Tools Configuration

Tools can be specified as simple string references or as tool configuration objects:
Note: Tools must be registered in a tool_registry dictionary when loading the YAML. The registry maps tool names to Tool objects.

Parser Configuration (Structured Output)

Use the parser field to define structured output schemas:

Examples Configuration

Provide example input/output pairs to guide the agent:

Loading and Using YAML Agents

Basic Loading

Writing/Saving YAML Configuration

To save an agent configuration to YAML, you can manually construct the YAML structure:

Helper Function for Exporting

Here’s a more complete helper function to export agent configurations:

Using Variables in Prompts

You can use variables in your prompts by using <variable_name> syntax. Variables are provided at runtime:

Tool Integration

Tools must be registered in a tool registry when loading YAML:
Alternatively, you can add tools after loading:

Best Practices

YAML Structure

  1. Use meaningful names: Choose descriptive agent and variable names
  2. Version your configurations: Always include version numbers
  3. Document thoroughly: Add descriptions for all components
  4. Validate schemas: Use YAML schema validation tools

Performance Optimization

Security Considerations

Validation and Testing

Schema Validation

Use the AgentYamlModel for proper validation of YAML configurations:
You can also use AgentBuilder.from_yaml() which automatically validates the configuration:

Testing YAML Agents

Examples

Customer Support Agent

customer-support.yaml

Data Analysis Agent

data-analyst.yaml
This YAML-based approach makes agent configuration declarative, versionable, and easily shareable across teams!