Configuration parameters for creating a commit action handler (WRITE pattern).
Defines validation, action execution, and response messages for state-modifying operations.
Param: error
The error object thrown during execution
Param: clientId
The client identifier
Param: agentName
The name of the current agent
Called when executeAction throws an exception
Error message is automatically committed as tool output and failureMessage is executed
Param: dto
Validation context object
Param: dto.clientId
The client identifier
Param: dto.agentName
The name of the current agent
Param: dto.toolCalls
Array of tool calls in current execution
Param: dto.params
Tool call parameters
Returns
Error message if validation fails, null if valid
Param: params
Tool call parameters (validated if validateParams was provided)
Param: clientId
The client identifier
Param: agentName
The name of the current agent
Returns
Result string to commit as tool output (empty string if action produced no result)
Param: params
Tool call parameters
Param: clientId
The client identifier
Param: agentName
The name of the current agent
Returns
Message to commit as tool output
Default
"Action executed but produced no result"
Example
// Payment action with validation and error handling constpaymentAction = createCommitAction({ fallback: (error, clientId, agentName) => { console.error(`Payment action failed for ${clientId} (${agentName}):`, error); }, validateParams:async ({ params, clientId, agentName, toolCalls }) => { if (!params.bank_name) return"Bank name is required"; if (!params.amount) return"Amount is required"; returnnull; // Valid }, executeAction:async (params, clientId) => { awaitcommitAppAction(clientId, "credit-payment", params); return"Payment page opened successfully"; }, successMessage:"what is this page about", failureMessage:"Could not open payment page", });
Configuration parameters for creating a commit action handler (WRITE pattern). Defines validation, action execution, and response messages for state-modifying operations.
Param: error
The error object thrown during execution
Param: clientId
The client identifier
Param: agentName
The name of the current agent
Param: dto
Validation context object
Param: dto.clientId
The client identifier
Param: dto.agentName
The name of the current agent
Param: dto.toolCalls
Array of tool calls in current execution
Param: dto.params
Tool call parameters
Returns
Error message if validation fails, null if valid
Param: params
Tool call parameters (validated if validateParams was provided)
Param: clientId
The client identifier
Param: agentName
The name of the current agent
Returns
Result string to commit as tool output (empty string if action produced no result)
Param: params
Tool call parameters
Param: clientId
The client identifier
Param: agentName
The name of the current agent
Returns
Message to commit as tool output
Default
Example