Docker build
Summary by Sourcery
Add YAML Agentfile support with auto-detection, structured output validation via JSONSchema and external schema files, environment variable expansion, and CLI enhancements for conversion and validation. Update documentation with examples for both Dockerfile and YAML formats, introduce extensive tests for new features, and configure CI workflows.
New Features:
- Support parsing and auto-detecting YAML Agentfile format via a new YAML parser
- Enable structured output validation using JSONSchema or external schema files through an OUTPUT_FORMAT directive
- Implement environment variable expansion (${VAR} and $VAR) in Agentfiles and MCP server ENV values
- Add CLI commands and flags (--format, --from-yaml, convert, validate) for format conversion and validation
Enhancements:
- Extend build_from_agentfile to accept a format hint and auto-detect format
- Enhance agent code generation to include RequestParams for response_format in both agno and fast-agent frameworks
CI:
- Introduce GitHub Actions workflows for testing, linting, Docker build & push, and Claude bot integration
Documentation:
- Revise README to showcase Dockerfile-style and YAML Agentfile formats, environment variable expansion, and structured output support
- Add example projects demonstrating both formats and structured output workflows
Tests:
- Add unit tests covering YAML parsing, format detection, conversion utilities, and JSONSchema validation
- Expand existing tests to cover OUTPUT_FORMAT, env var expansion, and CLI conversion/validation
Chores:
- Add jsonschema-based schema module for YAML Agentfile validation
- Update pyproject.toml and CI configs to accommodate new linting rules and workflows
Reviewer's Guide
This PR introduces full YAML Agentfile support with auto-detection and conversion utilities, enriches the CLI with explicit format flags and new convert/validate commands, implements environment variable expansion in parsing, refactors list handling in code generation for consistency, updates documentation and examples for both Dockerfile and YAML formats, and expands test coverage and CI workflows to validate the new capabilities.
Sequence diagram for CLI build/run with format detection and environment variable expansion
sequenceDiagram
actor User
participant CLI as agentman CLI
participant Parser as AgentfileParser/YamlParser
participant Builder as AgentBuilder
participant OS as OS/Env
User->>CLI: agentman build/run [--format/--from-yaml] .
CLI->>Parser: parse_file(agentfile_path, format_hint)
Parser->>OS: Read Agentfile/Agentfile.yml
Parser->>OS: Expand environment variables in values
Parser-->>CLI: AgentfileConfig
CLI->>Builder: build_all(AgentfileConfig)
Builder->>OS: Generate agent files
Builder-->>CLI: Build complete
CLI-->>User: Success message
ER diagram for Agentfile YAML structure
erDiagram
AGENTFILE {
string apiVersion
string kind
}
AGENT {
string name
string instruction
string model
boolean use_history
boolean human_input
boolean default
OutputFormat output_format
}
MCP_SERVER {
string name
string command
string[] args
string transport
string url
map env
}
AGENTFILE ||--o{ AGENT : agents
AGENTFILE ||--o{ MCP_SERVER : mcp_servers
AGENT }o--|| OutputFormat : output_format
Class diagram for AgentfileParser, AgentfileYamlParser, and OutputFormat
classDiagram
class AgentfileParser {
+AgentfileConfig config
+parse_file(filepath)
+parse_content(content)
}
class AgentfileYamlParser {
+AgentfileConfig config
+parse_file(filepath)
+parse_content(content)
}
class OutputFormat {
+str type
+Dict schema
+str file
}
class Agent {
+str name
+str instruction
+List servers
+str model
+bool use_history
+bool human_input
+bool default
+OutputFormat output_format
+to_decorator_string(...)
}
AgentfileParser --|> AgentfileYamlParser : format auto-detection
Agent "1" -- "0..1" OutputFormat : output_format
Class diagram for CLI subcommands and conversion utilities
classDiagram
class CLI {
+build_cli(args)
+run_cli(args)
+convert_cli(args)
+validate_cli(args)
}
class Converter {
+convert_agentfile(input, output, target_format)
+dockerfile_to_yaml(...)
+yaml_to_dockerfile(...)
+validate_agentfile(...)
}
CLI ..> Converter : uses
File-Level Changes
| Change | Details | Files |
|---|---|---|
| Introduce YAML Agentfile parsing with auto-detection |
|
src/agentman/yaml_parser.py |
| Extend build workflow and add conversion utilities |
|
src/agentman/agent_builder.pysrc/agentman/converter.py |
| Enhance CLI with format flags, conversion, and validation subcommands |
|
src/agentman/cli.py |
| Enable environment variable expansion in Agentfile parsing |
|
src/agentman/agentfile_parser.pysrc/agentman/yaml_parser.py |
| Refactor code generation to use consistent list structures |
|
src/agentman/frameworks/agno.pysrc/agentman/frameworks/fast_agent.py |
| Update documentation and examples with dual-format support and env var usage |
|
README.mdexamples/ |
| Expand tests and CI workflows for new features |
|
tests/test_yaml_parser.py.github/workflows/test.yml.github/workflows/docker-build.yml.github/workflows/claude.yml |
Tips and commands
Interacting with Sourcery
- Trigger a new review: Comment
@sourcery-ai reviewon the pull request. - Continue discussions: Reply directly to Sourcery's review comments.
- Generate a GitHub issue from a review comment: Ask Sourcery to create an
issue from a review comment by replying to it. You can also reply to a
review comment with
@sourcery-ai issueto create an issue from it. - Generate a pull request title: Write
@sourcery-aianywhere in the pull request title to generate a title at any time. You can also comment@sourcery-ai titleon the pull request to (re-)generate the title at any time. - Generate a pull request summary: Write
@sourcery-ai summaryanywhere in the pull request body to generate a PR summary at any time exactly where you want it. You can also comment@sourcery-ai summaryon the pull request to (re-)generate the summary at any time. - Generate reviewer's guide: Comment
@sourcery-ai guideon the pull request to (re-)generate the reviewer's guide at any time. - Resolve all Sourcery comments: Comment
@sourcery-ai resolveon the pull request to resolve all Sourcery comments. Useful if you've already addressed all the comments and don't want to see them anymore. - Dismiss all Sourcery reviews: Comment
@sourcery-ai dismisson the pull request to dismiss all existing Sourcery reviews. Especially useful if you want to start fresh with a new review - don't forget to comment@sourcery-ai reviewto trigger a new review!
Customizing Your Experience
Access your dashboard to:
- Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others.
- Change the review language.
- Add, remove or edit custom review instructions.
- Adjust other review settings.
Getting Help
- Contact our support team for questions or feedback.
- Visit our documentation for detailed guides and information.
- Keep in touch with the Sourcery team by following us on X/Twitter, LinkedIn or GitHub.