tine run

Execute a Python script and automatically capture the resulting run tree. This is the primary way to run opentine agents from the command line.

Usage

Terminal
tine run <script.py>

How It Works

When you invoke tine run, the CLI executes the specified Python script and scans the module's top-level scope for a Run object. Once found, the run tree is serialized and saved to disk automatically.

  1. 1. Execute the script — The script is run as a Python module in a subprocess.
  2. 2. Discover the Run object — After execution, opentine inspects module-level variables for an instance of Run. The first one found is used.
  3. 3. Save the run tree — The run is serialized to a .tine file at .tine_runs/{run.id}.tine in the current working directory.

Example

Given a script that creates and runs an agent:

research.py
1from opentine import Agent
2from opentine.models.anthropic import Anthropic
3from opentine.tools.web import search, fetch
4
5agent = Agent(
6    model=Anthropic("claude-sonnet-4-20250514"),
7    tools=[search, fetch],
8)
9
10# tine run looks for this Run object in module scope
11run = agent.run_sync("Research quantum computing breakthroughs")

Run it with the CLI:

Terminal
tine run research.py

Example output:

Terminal
Running research.py...
Found Run object: run_a3f8c1d2
Status: completed | Steps: 12 | Cost: $0.0341 | Duration: 18.7s
Saved to .tine_runs/run_a3f8c1d2.tine

Run Object Discovery

The CLI scans for Runinstances in the module's global scope. You can assign it to any variable name — run, result,my_run — as long as it is a Run instance at the top level of the module.

If no Run object is found, the CLI exits with an error message explaining what it looked for and suggesting you assign the return value of agent.run_sync() to a module-level variable.

Output Location

Runs are saved to the .tine_runs/directory, which is created automatically if it doesn't exist. The filename is the run's ID with a .tine extension. You can then use tine show, tine fork, or any other CLI command to work with the saved run.