Command
Command API for AgentGraph in PyAgenity.
This module provides the Command class, which allows nodes to combine state updates with control flow, similar to LangGraph's Command API. Nodes can update agent state and direct graph execution to specific nodes or graphs.
Classes:
Name | Description |
---|---|
Command |
Command object that combines state updates with control flow. |
Attributes:
Name | Type | Description |
---|---|---|
StateT |
|
Attributes¶
Classes¶
Command
¶
Command object that combines state updates with control flow.
Allows nodes to update agent state and direct graph execution to specific nodes or graphs. Similar to LangGraph's Command API.
Methods:
Name | Description |
---|---|
__init__ |
Initialize a Command object. |
__repr__ |
Return a string representation of the Command object. |
Attributes:
Name | Type | Description |
---|---|---|
PARENT |
|
|
goto |
|
|
graph |
|
|
state |
|
|
update |
|
Source code in pyagenity/utils/command.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
Attributes¶
Functions¶
__init__
¶
__init__(update=None, goto=None, graph=None, state=None)
Initialize a Command object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
|
StateT | None | Message | str | BaseConverter
|
State update to apply. |
None
|
|
str | None
|
Next node to execute (node name or END). |
None
|
|
str | None
|
Which graph to navigate to (None for current, PARENT for parent). |
None
|
|
StateT | None
|
Optional agent state to attach. |
None
|
Source code in pyagenity/utils/command.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
__repr__
¶
__repr__()
Return a string representation of the Command object.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
String representation of the Command. |
Source code in pyagenity/utils/command.py
54 55 56 57 58 59 60 61 62 63 64 |
|