Class ComposedAgentListener
java.lang.Object
dev.langchain4j.agentic.observability.ComposedAgentListener
- All Implemented Interfaces:
AgentListener
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(AgentListener listener) voidafterAgenticScopeCreated(AgenticScope agenticScope) voidafterAgentInvocation(AgentResponse agentResponse) voidafterAgentToolExecution(AfterAgentToolExecution afterAgentToolExecution) voidbeforeAgenticScopeDestroyed(AgenticScope agenticScope) voidbeforeAgentInvocation(AgentRequest agentRequest) voidbeforeAgentToolExecution(BeforeAgentToolExecution beforeAgentToolExecution) static AgentListenercompose(AgentListener existingListener, AgentListener newListener) Composes a newly registered listener with the existing one, if any.static AgentListenercomposeWithInherited(AgentListener localListener, AgentListener parentListener) booleancontains(AgentListener listener) booleanIndicates whether this listener should be used only to the agent where it is registered (default) or also inherited by its subagents.static <T extends AgentListener>
TlistenerOfType(AgentListener rootListener, Class<T> listenerType) voidonAgenticSystemSuspended(AgenticScope agenticScope) voidonAgentInvocationError(AgentInvocationError agentInvocationError)
-
Constructor Details
-
ComposedAgentListener
-
-
Method Details
-
addListener
-
listeners
-
beforeAgentInvocation
- Specified by:
beforeAgentInvocationin interfaceAgentListener
-
afterAgentInvocation
- Specified by:
afterAgentInvocationin interfaceAgentListener
-
onAgentInvocationError
- Specified by:
onAgentInvocationErrorin interfaceAgentListener
-
afterAgentToolExecution
- Specified by:
afterAgentToolExecutionin interfaceAgentListener
-
beforeAgentToolExecution
- Specified by:
beforeAgentToolExecutionin interfaceAgentListener
-
afterAgenticScopeCreated
- Specified by:
afterAgenticScopeCreatedin interfaceAgentListener
-
beforeAgenticScopeDestroyed
- Specified by:
beforeAgenticScopeDestroyedin interfaceAgentListener
-
onAgenticSystemSuspended
- Specified by:
onAgenticSystemSuspendedin interfaceAgentListener
-
contains
-
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
-
compose
Composes a newly registered listener with the existing one, if any. When the existing listener is already aComposedAgentListener, the new listener is added to it.- Returns:
- the listener to be used in place of the existing one
-
composeWithInherited
public static AgentListener composeWithInherited(AgentListener localListener, AgentListener parentListener) -
listenerOfType
public static <T extends AgentListener> T listenerOfType(AgentListener rootListener, Class<T> listenerType)
-