Analyze Knowledge Base responses from Autonomous Nodes in Botpress with the “After LLMz Execution” hook.
Capture metrics like query content, response source, and user context for precise insights into Knowledge Base interactions and improved bot performance.
event
: The Event object with details about the interaction.execution
: An object containing data on the LLMz execution, including details of each iteration and response content. More information on the execution
object structure is provided below.execution
Objectexecution
object provides detailed information about the actions taken by the Autonomous Node, specifically capturing each iteration and its outcome. This includes messages sent, code executed, signals received, and more. Here’s an in-depth look at its structure and contents:
execution
Objectstatus
: String indicating the overall status of the execution, e.g., "success"
, "partial"
, "failure"
.
iterations
: Array of objects, each representing a step or interaction in the Autonomous Node’s execution. Each iteration contains:
message
: The text response generated at this stage.code
: Code executed during this iteration, often in response to specific queries.variables
: Object holding variables used within the iteration.status
: Status of the individual iteration, e.g., "partial"
, "success"
.signal
: Information on any signals received, often in the form of structured ThinkSignal
or other signals, detailing contextual reasoning.started_ts
: Timestamp (in milliseconds) indicating when the iteration started.ended_ts
: Timestamp (in milliseconds) when the iteration concluded.llm
: Object detailing the large language model used, including its version and parameters.mutations
: Array of any mutations or transformations applied to variables.traces
: Trace data related to the LLM’s decisions and actions.messages
: Messages used or processed within this step.notebook
: Object representing any generated or stored notebook content for reference.context
: Contains settings, variables, and tools relevant to the execution:
__options
: Execution settings such as the model version, number of loops, temperature, and specific instructions.transcript
: Transcript of messages exchanged, with each entry detailing user and bot interactions.getMessages
: Function for retrieving messages, typically used internally for processing.partialExecutionMessages
: Array holding messages generated if the execution is paused or partially completed.tool_names
: Names of tools used in the execution, e.g., APIs or functions.iteration
: Current iteration count in the execution loop.injectedVariables
: Variables introduced during execution, such as results from knowledge base queries.location
: Provides information about the Autonomous Node’s current position in the Workflow:
type
: Indicates whether it’s a Workflow or standalone operation.workflowId
: Unique identifier for the Workflow.workflowName
: Name of the Workflow where the execution takes place.nodeId
: Identifier for the specific node within the Workflow.nodeName
: Name of the node, e.g., "AutonomousNode"
.