Attributes
- Companion
- class
- Graph
-
- Supertypes
-
trait Producttrait Mirrorclass Objecttrait Matchableclass Any
- Self type
-
AgentState.type
Members list
Type members
Inherited and Abstract types
The names of the product elements
The names of the product elements
Attributes
- Inherited from:
- Mirror
The name of the type
The name of the type
Attributes
- Inherited from:
- Mirror
Value members
Concrete methods
Deserialize agent state from JSON.
Deserialize agent state from JSON.
Tools must be provided separately as they cannot be serialized.
Value parameters
- json
-
The JSON representation
- tools
-
The tool registry to use (must be provided by caller)
Attributes
- Returns
-
Result containing the deserialized state or an error
Load state from file (convenience method).
Load state from file (convenience method).
This performs I/O and may fail with filesystem errors or parse errors.
Value parameters
- path
-
File path to read from
- tools
-
The tool registry to use (tools are not serialized)
Attributes
- Returns
-
Result containing the loaded state or an error
Prune conversation history based on configuration. Returns a new AgentState with pruned conversation.
Prune conversation history based on configuration. Returns a new AgentState with pruned conversation.
This is a pure function - it does not modify the input state.
Value parameters
- config
-
Context window configuration
- state
-
The current agent state
- tokenCounter
-
Function to count tokens in messages (optional, uses simple heuristic by default)
Attributes
- Returns
-
New state with pruned conversation
Save state to file (convenience method).
Save state to file (convenience method).
This performs I/O and may fail with filesystem errors.
Value parameters
- path
-
File path to write to
- state
-
The state to save
Attributes
- Returns
-
Result indicating success or error
Serialize agent state to JSON.
Serialize agent state to JSON.
Note: ToolRegistry is not serialized (contains function references). Tools must be re-registered when loading state.
Value parameters
- state
-
The agent state to serialize
Attributes
- Returns
-
JSON representation