Action Parameters Reference
This section describes the special parameters automatically provided to actions by the NeMo Guardrails library.
Special Parameters
When you include these parameters in your action’s function signature, they are automatically populated:
Special parameters are only injected for actions that run locally. When an actions_server_url is configured, non-system actions are sent to the remote server and do not receive these parameters. To ensure an action always receives special parameters, mark it with is_system_action=True. When no actions server is configured, all actions run locally and receive these parameters regardless of is_system_action.
The context Parameter
The context parameter provides access to conversation state and variables:
Common Context Variables
Accessing Custom Context
Custom context variables set in flows are also accessible:
The events Parameter
The events parameter provides the complete event history:
Event Types
Event Structure Example
The llm Parameter
The llm parameter provides direct access to the LLM instance:
Use Cases for LLM Access
- Custom prompt engineering
- Multiple LLM calls within a single action
- Specialized text processing
Action-Specific LLM
You can register a dedicated LLM for a specific action using the {action_name}_llm naming convention. When registered, it overrides the default llm parameter for that action:
When my_custom_action runs and requests the llm parameter, it receives specialized_llm instead of the default LLM.
The config Parameter
The config parameter provides access to the full configuration:
Configuration Access Examples
The llm_task_manager Parameter
The llm_task_manager parameter provides access to prompt rendering and LLM task management:
Combining Multiple Parameters
You can use multiple special parameters together:
Parameter Type Annotations
Always use proper type annotations for special parameters:
Related Topics
- Registering Actions - Ways to register actions
- Built-in Actions - Default actions in the library
- Creating Custom Actions - Create your own actions