Runs
Toolang organizes execution into threads, runs, and steps, from persistent context to individual operations.
| Concept | Description |
|---|---|
| Thread | A persistent context that connects related runs and their history. |
| Run | A single execution with inputs, status, and a result or error. |
| Step | An individual model call, tool call, or flow operation within a run. |
Execution hierarchy
Each request starts a root run. Calls to other runnables create child runs within the same thread, forming a tree of execution.
Each run tracks its own inputs, status, results, and steps. A thread retains the history across multiple runs, allowing subsequent requests to build on earlier work.
Canceling a run stops its active work but does not undo completed external actions. Stopping an agent runtime is separate from canceling a run.
History and context
Toolang provides several ways to manage execution context and history:
- Recall retrieves earlier context through
near(recent messages) andfar(summarized history). - Compaction summarizes older context to reduce model context usage while preserving execution records.
- Fork creates a new thread from selected history, including the selected run.
- Rewind moves the visible history back to before a selected run without deleting stored records.
These operations affect context and history, not external side effects such as file changes or sent messages.
Run limits
Run limits control resource consumption and execution duration.
| Limit | Measures | Scope |
|---|---|---|
agic_model_calls | Number of model calls | Each agic invocation |
agic_tool_calls | Number of tool calls | Each agic invocation |
tokens | Input and output tokens | Run tree |
cost | Model cost in USD | Run tree |
time | Elapsed time in seconds | Run tree |
Model and tool call counters reset for each agic invocation. Token, cost, and time budgets are shared across a run tree, including child runs. An independent root run starts with fresh budgets.
Call limits are checked before execution. Token and cost limits are evaluated after each model call, so the final call may exceed the configured budget.
Limits can be configured under [limit] or overridden with --limit for an invocation.
See Inspect and control runs for managing active runs and Configuration for limit settings.