Validation System Overview
AgentMap provides a sophisticated validation system that ensures the integrity and correctness of your workflow definitions and configuration files. The validation system helps catch errors early in the development process, provides detailed feedback, and maintains performance through intelligent caching.
System Architectureâ
The validation system is built around a modular architecture with specialized services handling different aspects of validation:
Core Componentsâ
- ValidationService: Main orchestrator that coordinates all validation activities
- CSVValidationService: Handles CSV workflow file validation with graph consistency checks
- ConfigValidationService: Validates YAML configuration files and settings
- ValidationCacheService: Manages MD5-based caching for performance optimization
Validation Workflowâ
Validation Levelsâ
The system provides three levels of feedback to help you understand the state of your files:
â Errorsâ
- Impact: Block execution and compilation
- Examples: Missing required columns, invalid node references, schema violations
- Action Required: Must be fixed before proceeding
â ī¸ Warningsâ
- Impact: Allow execution but indicate potential issues
- Examples: Unknown agent types, large prompts, missing API keys
- Action Recommended: Should be reviewed and addressed
âšī¸ Infoâ
- Impact: Informational messages about your workflow
- Examples: Graph statistics, entry points, terminal nodes
- Action Optional: Provides useful insights for optimization
Caching Mechanismâ
The validation system uses intelligent caching to improve performance:
Cache Key Generationâ
- File Hash: MD5 hash of file contents for change detection
- Cache Location:
~/.agentmap/validation_cache/
- File Format:
{filename}_{hash}.json
Cache Managementâ
- Expiry: 24 hours by default
- Invalidation: Automatic when file content changes
- Cleanup: Built-in expired cache removal
Performance Benefitsâ
- First Validation: Full validation performed, result cached
- Subsequent Validations: Instant cache retrieval if file unchanged
- Development Speed: Faster iteration cycles during development
Validation Componentsâ
CSV Validationâ
Comprehensive validation of workflow definition files including:
- Column structure and naming (with alias support)
- Row-level data validation using Pydantic models
- Graph consistency and topology checks
- Agent type verification against registry
- Routing logic validation
Config Validationâ
Complete validation of YAML configuration files including:
- Schema validation using Pydantic ConfigModel
- Path existence and accessibility checks
- LLM provider configuration verification
- Cross-reference validation between sections
- Environment variable validation
Cache Managementâ
Efficient caching system providing:
- MD5-based change detection
- Automatic cache expiry and cleanup
- Cache statistics and monitoring
- Manual cache control commands
Integration Pointsâ
Development Workflowâ
# Validate during development
agentmap validate csv --csv workflows/my_workflow.csv
# Validate before compilation
agentmap validate all --fail-on-warnings
# CI/CD integration
agentmap validate all --no-cache --fail-on-warnings
CLI Integrationâ
The validation system integrates seamlessly with AgentMap's CLI:
- Individual Validation:
validate csv
,validate config
- Comprehensive Validation:
validate all
- Cache Management:
validate cache --stats
,validate cache --clear
Compilation Integrationâ
Validation is automatically triggered during compilation:
- Pre-compilation Checks: Ensure valid workflow before processing
- Error Blocking: Invalid workflows prevent compilation
- Performance: Cached results speed up repeated compilations
Best Practicesâ
Development Phaseâ
- Validate Early: Run validation after significant changes
- Use Cache: Let caching speed up development iterations
- Address Warnings: Don't ignore warnings - they prevent future issues
- Monitor Info: Use info messages to optimize workflow design
CI/CD Integrationâ
- Mandatory Validation: Include validation in build pipelines
- Fail on Warnings: Use
--fail-on-warnings
for production deployments - No Cache: Use
--no-cache
for clean CI/CD validation - Error Reporting: Capture validation output for debugging
Production Deploymentâ
- Complete Validation: Always run
validate all
before deployment - Environment Checks: Ensure API keys and paths are configured
- Graph Verification: Confirm workflow topology is correct
- Agent Availability: Verify all agent types are accessible
Troubleshootingâ
Common Issuesâ
Cache Problems
# Clear cache for fresh validation
agentmap validate cache --clear
# Check cache statistics
agentmap validate cache --stats
Performance Issues
# Skip cache for one-time validation
agentmap validate csv --no-cache
# Clean up expired cache entries
agentmap validate cache --cleanup
Validation Errors
- Check CSV Validation Guide for specific CSV issues
- Review Config Validation Guide for configuration problems
- Use
--help
with any validation command for detailed options
Related Documentationâ
- CSV Validation Guide: Detailed CSV validation capabilities
- Config Validation Guide: Configuration file validation
- Validation Cache Management: Cache system details
- Validation Best Practices: Development workflow integration
- CLI Commands Reference: Command-line validation tools
- CSV Schema Reference: Complete CSV format specification
Next Stepsâ
- Learn CSV Validation: Review the CSV validation guide for workflow validation
- Configure Validation: Set up config validation for your environment
- Optimize Performance: Understand cache management for faster development
- Best Practices: Follow validation best practices for efficient workflows