📚 API ReferenceComponents
<ActionModifier>
Intercept and modify agent action handling.
The ActionModifier
enables middleware-like modification of actions within your agent system, allowing for pre and post-processing of actions. The ActionModifier
component serves as a wrapper that intercepts and modifies actions before and after execution.
Import
Usage
Here's a basic example of using the ActionModifier
:
Props
Prop | Type | Default |
---|---|---|
before | Function(action) => action | N/A |
after | Function(result) => result | N/A |
Best Practices
- Keep modifiers focused on specific concerns
- Chain multiple modifiers for complex modifications
- Handle errors appropriately in before/after handlers
- Avoid heavy computations that might block the main thread
- Return the modified action/result from handlers