> ## Documentation Index
> Fetch the complete documentation index at: https://icrl.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Agent

> Main Python agent class

## Constructor

```python theme={null}
Agent(
    llm: LLMProvider,
    db_path: str,
    plan_prompt: str,
    reason_prompt: str,
    act_prompt: str,
    k: int = 3,
    max_steps: int = 30,
    seed_trajectories: list[Trajectory] | None = None,
    on_step: Callable[[Step, StepContext], None] | None = None,
    curation_threshold: float = 0.3,
    curation_min_retrievals: int = 5,
    verify_trajectory: Callable[[Trajectory], bool] | None = None,
)
```

## Core Methods

```python theme={null}
await agent.train(env, goal)
await agent.run(env, goal)
agent.train_sync(env, goal)
agent.run_sync(env, goal)
await agent.train_batch(env_factory, goals)
await agent.run_batch(env_factory, goals)
agent.get_stats()
```

## Notes

* `train` stores successful trajectories (subject to `verify_trajectory`).
* `run` never writes new trajectories.
* `database` property exposes the underlying `TrajectoryDatabase`.

## Stats Shape

`get_stats()` returns:

* `total_trajectories`
* `successful_trajectories`
* `success_rate`
