Package org.bsc.langgraph4j.annotation
Interface ActionCatalogRepository
public interface ActionCatalogRepository
A repository of node and edge actions built from the annotated methods of an
ActionCatalog.- Since:
- 1.9.6
-
Method Summary
Modifier and TypeMethodDescriptiondefault <State extends AgentState>
Edge<State> Creates a conditional edge from the given source node using a registered edge action.Map<String, AsyncCommandAction<? extends AgentState>> Returns the edge actions, indexed by action name.default <State extends AgentState>
Node<State> Creates a node whose id is the given action name.default <State extends AgentState>
Node<State> Creates a node with the given id and a registered node action.default <State extends AgentState>
Node.ActionFactory<State> nodeAction(String actionId) Returns the registered node action factory with the given name.Map<String, Node.ActionFactory<? extends AgentState>> Returns the node action factories, indexed by action name.static <Catalog extends ActionCatalog>
ActionCatalogRepositoryof(Catalog catalog) Builds a repository from the public methods of the catalog annotated withNodeActionorEdgeCondition.
-
Method Details
-
nodeActions
Map<String,Node.ActionFactory<? extends AgentState>> nodeActions()Returns the node action factories, indexed by action name.- Returns:
- the node actions
-
edgeActions
Map<String,AsyncCommandAction<? extends AgentState>> edgeActions()Returns the edge actions, indexed by action name.- Returns:
- the edge actions
-
edge
default <State extends AgentState> Edge<State> edge(String sourceId, String actionId, Map<String, String> mappings) Creates a conditional edge from the given source node using a registered edge action.- Type Parameters:
State- the agent state type- Parameters:
sourceId- the source node idactionId- the edge action namemappings- the mapping between action results and target node ids- Returns:
- the edge
- Throws:
IllegalArgumentException- if the edge action is not found
-
nodeAction
Returns the registered node action factory with the given name.- Type Parameters:
State- the agent state type- Parameters:
actionId- the node action name- Returns:
- the action factory
- Throws:
IllegalArgumentException- if the node action is not found
-
node
Creates a node whose id is the given action name.- Type Parameters:
State- the agent state type- Parameters:
id- the node action name, also used as node id- Returns:
- the node
- Throws:
IllegalArgumentException- if the node action is not found
-
node
Creates a node with the given id and a registered node action.- Type Parameters:
State- the agent state type- Parameters:
id- the node idactionId- the node action name- Returns:
- the node
- Throws:
IllegalArgumentException- if the node action is not found- Since:
- 1.9.7
-
of
Builds a repository from the public methods of the catalog annotated withNodeActionorEdgeCondition.- Type Parameters:
Catalog- the catalog type- Parameters:
catalog- the catalog instance- Returns:
- the repository
- Throws:
IllegalArgumentException- if action names are duplicated or a method signature is unsupported
-