agentgit.checkpoints package
Submodules
agentgit.checkpoints.checkpoint module
Checkpoint model for the LangGraph rollback agent system.
Represents saved states that can be restored with full execution history preservation.
- class agentgit.checkpoints.checkpoint.Checkpoint(id=None, internal_session_id=0, checkpoint_name=None, session_state=<factory>, conversation_history=<factory>, is_auto=False, created_at=None, metadata=<factory>, user_id=None, tool_invocations=<factory>)[source]
Bases:
object
Checkpoint model for saving and restoring LangGraph agent states.
A checkpoint captures the complete state of an internal session at a specific point in time, allowing non-destructive rollback to that state by creating a new internal session branch.
- id
Unique identifier for the checkpoint.
- internal_session_id
ID of the internal session this checkpoint was created from.
- checkpoint_name
Optional user-friendly name for the checkpoint.
- session_state
The agent’s session state at checkpoint time.
- conversation_history
The conversation history at checkpoint time.
- is_auto
Whether this checkpoint was created automatically.
- created_at
When this checkpoint was created.
- metadata
Additional metadata about the checkpoint.
- user_id
Optional ID of the user who owns this checkpoint.
- tool_invocations
History of tool invocations up to this checkpoint.
Example
>>> checkpoint = Checkpoint( ... internal_session_id=1, ... checkpoint_name="Before tool call", ... session_state={"counter": 5}, ... is_auto=True ... )
-
checkpoint_name:
Optional
[str
] = None
-
conversation_history:
List
[Dict
[str
,Any
]]
-
created_at:
Optional
[datetime
] = None
- classmethod from_dict(data)[source]
Create a Checkpoint from dictionary data.
- Parameters:
data (
dict
) – Dictionary containing checkpoint data.- Return type:
- Returns:
Checkpoint instance.
- classmethod from_internal_session(internal_session, checkpoint_name=None, is_auto=False, user_id=None, tool_invocations=None)[source]
Create a checkpoint from an internal session.
- Parameters:
internal_session – The internal session to checkpoint.
checkpoint_name (
Optional
[str
]) – Optional name for the checkpoint.is_auto (
bool
) – Whether this is an automatic checkpoint.user_id (
Optional
[int
]) – Optional user ID who owns this checkpoint.tool_invocations (
Optional
[List
[Dict
[str
,Any
]]]) – Optional tool invocation history.
- Return type:
- Returns:
New Checkpoint instance with session data.
- get_summary()[source]
Get a summary of the checkpoint for display.
- Return type:
str
- Returns:
Human-readable summary of the checkpoint.
- get_tool_track_position()[source]
Get the tool track position from metadata.
- Return type:
int
- Returns:
The tool track position, or 0 if not set.
- has_tool_invocations()[source]
Check if this checkpoint has any tool invocations.
- Return type:
bool
- Returns:
True if there are tool invocations, False otherwise.
-
id:
Optional
[int
] = None
-
internal_session_id:
int
= 0
-
is_auto:
bool
= False
-
metadata:
Dict
[str
,Any
]
-
session_state:
Dict
[str
,Any
]
- to_dict()[source]
Convert checkpoint to dictionary representation.
- Return type:
dict
- Returns:
Dictionary with checkpoint data.
-
tool_invocations:
List
[Dict
[str
,Any
]]
-
user_id:
Optional
[int
] = None