Agent Pre-Processor
The Agent Pre-Processor lets you run custom scripts before an agent is invoked. Scripts can access system memory and context variables to perform data transformation, validation, and context preparation. The configured script runs automatically each time the agent is invoked.This feature is currently enabled on request.
Common Use Cases
| Use Case | Description |
|---|---|
| Security | Content moderation |
| Validation | Input normalization, schema enforcement, and type checking |
| Enrichment | Adding user metadata, timestamps, and domain tags |
| Customization | Domain-specific prompts and tool filtering |
Available Context Keys
The following keys are available within the script, along with any context and memory variables:| Key | Description |
|---|---|
input | The user input being processed |
task_input | The structured payload passed to the agent for this execution |
agent_prompt | The prompt used to guide the agent’s behavior and responses |
available_tools | Metadata about the tools, agents, and events the agent can use. Contents vary based on the app’s orchestration pattern |
Adding a Pre-Processor Script
- In the agent configuration, go to Pre-Processor → Add Script.
- Write your script in JavaScript or Python using the available context keys listed above.
- Click Test Execution to verify the script’s behavior.
- Click Create to save.
There is no execution timeout for scripts. Ensure your script does not introduce unnecessary delays.