Overview
Laddr provides three base system tool classes that you can import and use to build custom overrides:TaskDelegationTool- Single-task delegation to other agentsParallelDelegationTool- Parallel multi-task delegation (fan-out pattern)ArtifactStorageTool- Storage and retrieval of large data artifacts
Importing Base Tools
You can import the base tools from three different locations:Top-Level Import (Recommended)
Core Module Import
Direct Module Import
Importing the Override Decorator
To register your custom tools, you’ll need the override decorator:Understanding System Tool Architecture
Runtime Injection
When your custom tool override is called, the Laddr runtime automatically injects three special keyword arguments:_message_bus- The message queue backend (Redis/Kafka)_artifact_storage- The storage backend (MinIO/S3)_agent- The current agent instance (for job_id propagation)
Base Tool Initialization
All base tool classes accept these dependencies in their constructors:Common Patterns
Pattern 1: Enhance with Pre/Post Processing
Add logging, metrics, or validation while reusing base functionality:Pattern 2: Add Rate Limiting
Control delegation rate to prevent overwhelming downstream agents:Pattern 3: Add Retry Logic
Implement automatic retries for failed delegations:Pattern 4: Add Circuit Breaker
Prevent cascading failures by stopping delegation to failing agents:Pattern 5: Custom Artifact Storage with Compression
Add automatic compression for large artifacts:System Tool Reference
TaskDelegationTool
Handles single-task delegation to other agents.ParallelDelegationTool
Handles parallel multi-task delegation (fan-out pattern).ArtifactStorageTool
Handles storage and retrieval of large data artifacts.Available System Tools to Override
You can override any of the following system tools:system_delegate_task- Single task delegationsystem_delegate_parallel- Parallel task delegationsystem_store_artifact- Store data artifactsystem_retrieve_artifact- Retrieve data artifact
Registering Your Overrides
In Agent Files
Define your overrides in your agent Python file:In Separate Override Modules
Create a dedicated module for your overrides:Testing Your Overrides
Verify Override Registration
Clear Overrides (for testing)
Best Practices
1. Always Accept Runtime-Injected Parameters
Your override functions must accept these parameters:2. Reuse Base Tools When Possible
Don’t reimplement delegation logic - use the base tools:3. Preserve Function Signatures
Maintain compatibility with the original system tool signatures.4. Handle Errors Gracefully
5. Add Comprehensive Logging
Troubleshooting
Override Not Being Called
-
Check registration:
- Verify import: Make sure your override module is imported before the agent runs
- Check function signature: Ensure your override has the required parameters
Runtime Injection Not Working
Make sure you’re accepting the injected parameters:Base Tool Not Working
Ensure you’re passing the injected dependencies correctly:Next Steps
- Quickstart Guide - Get started in 5 minutes
- Migration Guide - Upgrade existing overrides
- Agent Configuration - Configure agents