Skip to main content
This guide explains how to create custom system tools by importing and extending Laddr’s base tool classes.

Overview

Laddr provides three base system tool classes that you can import and use to build custom overrides:
  • TaskDelegationTool - Single-task delegation to other agents
  • ParallelDelegationTool - Parallel multi-task delegation (fan-out pattern)
  • ArtifactStorageTool - Storage and retrieval of large data artifacts
These classes are fully composable, meaning you can use them as building blocks within your custom tool implementations.

Importing Base Tools

You can import the base tools from three different locations:

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)
These are injected by the runtime - you don’t pass them manually.

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 delegation
  • system_delegate_parallel - Parallel task delegation
  • system_store_artifact - Store data artifact
  • system_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:
Then import in your agent:

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

  1. Check registration:
  2. Verify import: Make sure your override module is imported before the agent runs
  3. 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