AIAgentPipeline
Pipeline for AI agent features that provides interception points for various agent lifecycle events.
The pipeline allows features to:
Be installed into stage contexts
Intercept agent creation
Intercept node execution before and after it happens
Intercept LLM (Language Learning Model) calls before and after they happen
Intercept tool calls before and after they happen
This pipeline serves as the central mechanism for extending and customizing agent behavior through a flexible interception system. Features can be installed with custom configurations and can hook into different stages of the agent's execution lifecycle.
Functions
Retrieves all features associated with the given stage context.
Intercepts LLM calls after they are made to process or log the response.
Intercepts LLM calls with tools after they are made to process or log the structured response.
Intercepts node execution after it completes.
Intercepts the completion of an agent's operation and assigns a custom handler to process the result.
Intercepts and handles errors occurring during the execution of an AI agent's strategy.
Intercepts on before an agent started to modify or enhance the agent.
Intercepts LLM calls before they are made to modify or log the prompt.
Intercepts LLM calls with tools before they are made to modify or log the prompt and tools.
Intercepts node execution before it starts.
Set feature handler for Context Stage events
Intercepts environment creation to allow features to modify or enhance the agent environment.
Sets up an interceptor to handle the completion of a strategy for the given feature.
Intercepts strategy started event to perform actions when an agent strategy begins execution.
Intercepts and handles tool calls for the specified feature and its implementation. Updates the tool call handler for the given feature key with a custom handler.
Intercepts the result of a tool call with a custom handler for a specific feature.
Intercepts validation errors encountered during the execution of tools associated with the specified feature.
Notifies all registered LLM handlers after a language model call has completed.
Notifies all registered LLM handlers after a language model call with tools has completed.
Notifies all registered node handlers after a node has been executed.
Notifies all registered handlers that an agent has finished execution.
Notifies all registered handlers about an error that occurred during agent execution.
Notifies all registered handlers that an agent has started execution.
Notifies all registered LLM handlers before a language model call is made.
Notifies all registered LLM handlers before a language model call with tools is made.
Notifies all registered node handlers before a node is executed.
Notifies all registered strategy handlers that a strategy has finished execution.
Notifies all registered strategy handlers that a strategy has started execution.
Notifies all registered tool handlers when a tool is called.
Notifies all registered tool handlers when a tool call fails with an exception.
Notifies all registered tool handlers about the result of a tool call.
Notifies all registered tool handlers when a validation error occurs during a tool call.
Transforms the agent environment by applying all registered environment transformers.