Record Class SubAgent.SubAgentImpl
java.lang.Object
java.lang.Record
org.bsc.langgraph4j.spring.ai.agent.SubAgent.SubAgentImpl
- All Implemented Interfaces:
AgentEx.ToolBehaviour<org.springframework.ai.chat.messages.Message,,AgentExecutorEx.State> SubAgent,org.springframework.ai.tool.ToolCallback
- Enclosing interface:
SubAgent
public static record SubAgent.SubAgentImpl(org.springframework.ai.tool.ToolCallback delegate, CompiledGraph<AgentExecutorEx.State> subGraph)
extends Record
implements SubAgent
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.bsc.langgraph4j.spring.ai.agent.SubAgent
SubAgent.Input, SubAgent.SubAgentImpl -
Field Summary
Fields inherited from interface org.springframework.ai.tool.ToolCallback
logger -
Constructor Summary
ConstructorsConstructorDescriptionSubAgentImpl(org.springframework.ai.tool.ToolCallback delegate, CompiledGraph<AgentExecutorEx.State> subGraph) Creates an instance of aSubAgentImplrecord class. -
Method Summary
Modifier and TypeMethodDescriptionvoidRegisters the sub-agent as a node in the parent graph and adapts tool execution requests to the sub-agent message format.org.springframework.ai.tool.ToolCallbackdelegate()Returns the value of thedelegaterecord component.final booleanIndicates whether some other object is "equal to" this one.org.springframework.ai.tool.definition.ToolDefinitionfinal inthashCode()Returns a hash code value for this object.name()subGraph()Returns the value of thesubGraphrecord component.final StringtoString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.ai.tool.ToolCallback
getToolMetadata
-
Constructor Details
-
SubAgentImpl
public SubAgentImpl(org.springframework.ai.tool.ToolCallback delegate, CompiledGraph<AgentExecutorEx.State> subGraph) Creates an instance of aSubAgentImplrecord class.- Parameters:
delegate- the value for thedelegaterecord componentsubGraph- the value for thesubGraphrecord component
-
-
Method Details
-
name
- Specified by:
namein interfaceAgentEx.ToolBehaviour<org.springframework.ai.chat.messages.Message,AgentExecutorEx.State>
-
addToGraph
Registers the sub-agent as a node in the parent graph and adapts tool execution requests to the sub-agent message format.Before invoking the sub-graph, the pending tool call arguments are wrapped as a
UserMessage. After completion, the last sub-agent message is converted back into aToolResponseMessageassociated with the original tool call id.- Specified by:
addToGraphin interfaceAgentEx.ToolBehaviour<org.springframework.ai.chat.messages.Message,AgentExecutorEx.State> - Parameters:
graph- the parent graph receiving this sub-agent node- Throws:
GraphStateException- if graph node registration fails
-
getToolDefinition
public org.springframework.ai.tool.definition.ToolDefinition getToolDefinition()- Specified by:
getToolDefinitionin interfaceorg.springframework.ai.tool.ToolCallback
-
call
-
call
-
toString
-
hashCode
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
delegate
public org.springframework.ai.tool.ToolCallback delegate()Returns the value of thedelegaterecord component.- Returns:
- the value of the
delegaterecord component
-
subGraph
Returns the value of thesubGraphrecord component.- Returns:
- the value of the
subGraphrecord component
-