Trajectory Recording¶
Record agent execution trajectories for learning.
Automatic Recording (via wrap)¶
The simplest approach — wrap() handles recording automatically:
Manual Recording¶
from zubbl.types import Trajectory, Step, TaskStatus
trajectory = Trajectory(
trajectory_id="traj-001",
task_description="Analyze codebase for security issues",
steps=[
Step(action="read_file", tool_name="file_reader", tool_output="..."),
Step(action="analyze", tool_name="ast_parser", tool_output="..."),
],
status=TaskStatus.SUCCESS,
metadata={"tokens": 1240, "duration_ms": 3200},
)
zubbl.ingest(trajectory)
Step-by-Step Recording¶
tid = zubbl.start_trajectory("Analyze codebase for security issues")
zubbl.record_step(action="read_file", tool_name="file_reader", tool_output="...")
zubbl.record_step(action="analyze", tool_name="ast_parser", tool_output="...")
traj = zubbl.end_trajectory(status=TaskStatus.SUCCESS)
Step Fields¶
| Field | Type | Description |
|---|---|---|
action |
string | What the agent did |
tool_name |
string | Tool used (if any) |
tool_input |
dict | Input to the tool |
tool_output |
any | Output from the tool |
reasoning |
string | Agent's reasoning (if captured) |