Class AgentMonitor
java.lang.Object
dev.langchain4j.agentic.observability.AgentMonitor
- All Implemented Interfaces:
AgentListener
Monitors agent executions and provides observability for the LangChain4j Agentic system.
Generates a self-contained HTML report visualizing the static topology of an agentic system
and the dynamic execution traces.
The report includes:
- A visual tree chart of the agent hierarchy showing topology types, names, and properties
- A waterfall timeline of execution traces grouped by memory/session ID
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidafterAgentInvocation(AgentResponse agentResponse) allExecutionsFor(AgenticScope agenticScope) Returns all executions (successful, failed, and ongoing) for a given memory ID.allExecutionsFor(Object memoryId) Returns all executions (successful, failed, and ongoing) for a given memory ID.Returns the set of all memory IDs that have been tracked by this monitor, including successful, failed, and ongoing executions.voidbeforeAgentInvocation(AgentRequest agentRequest) failedExecutionsFor(AgenticScope agenticScope) failedExecutionsFor(Object memoryId) booleanIndicates whether this listener should be used only to the agent where it is registered (default) or also inherited by its subagents.voidonAgentInvocationError(AgentInvocationError agentInvocationError) ongoingExecutionFor(AgenticScope agenticScope) ongoingExecutionFor(Object memoryId) voidsetRootAgent(AgentInstance rootAgent) successfulExecutionsFor(AgenticScope agenticScope) successfulExecutionsFor(Object memoryId) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface AgentListener
afterAgenticScopeCreated, afterAgentToolExecution, beforeAgenticScopeDestroyed, beforeAgentToolExecution
-
Constructor Details
-
AgentMonitor
public AgentMonitor()
-
-
Method Details
-
setRootAgent
-
beforeAgentInvocation
- Specified by:
beforeAgentInvocationin interfaceAgentListener
-
afterAgentInvocation
- Specified by:
afterAgentInvocationin interfaceAgentListener
-
onAgentInvocationError
- Specified by:
onAgentInvocationErrorin interfaceAgentListener
-
inheritedBySubagents
public boolean inheritedBySubagents()Description copied from interface:AgentListenerIndicates whether this listener should be used only to the agent where it is registered (default) or also inherited by its subagents.- Specified by:
inheritedBySubagentsin interfaceAgentListener- Returns:
- true if the listener should be inherited by sub-agents, false otherwise
-
ongoingExecutions
-
ongoingExecutionFor
-
ongoingExecutionFor
-
successfulExecutions
-
successfulExecutionsFor
-
successfulExecutionsFor
-
failedExecutions
-
failedExecutionsFor
-
failedExecutionsFor
-
allMemoryIds
-
allExecutionsFor
Returns all executions (successful, failed, and ongoing) for a given memory ID. -
allExecutionsFor
Returns all executions (successful, failed, and ongoing) for a given memory ID.
-