Introduction

opentine is a 250-line Python framework that treats every AI agent execution as a first-class, forkable artifact. Think of it as git for agent runs.

Every step your agent takes is content-addressed, serializable, and forkable. When something goes wrong at step 23, you don't re-run 22 good steps. You fork from step 22 and try again.

Installation

Terminal
pip install opentine

# With specific model support
pip install "opentine[anthropic]"
pip install "opentine[openai]"
pip install "opentine[all]"

Quick Start

Here's a complete agent in under 15 lines. It creates a run tree, saves it to a .tine file, and can be forked from any step.

quickstart.py
1from opentine import Agent
2from opentine.models.anthropic import Anthropic
3from opentine.tools.web import search, fetch
4
5# Create an agent with any model
6agent = Agent(
7    model=Anthropic("claude-sonnet-4-20250514"),
8    tools=[search, fetch],
9)
10
11# Run it — every step is recorded
12run = agent.run_sync("Research the latest advances in quantum computing")
13
14# Save the entire run tree
15run.save("quantum_research.tine")
16
17# Later: fork from any step with a new approach
18forked = run.fork(from_step_id="abc123")
19# Resume from the fork point with a modified agent

Core Ideas

  • Run Trees: Every execution is a tree of Steps. Each Step has a kind (think, tool, model, done, error), inputs, outputs, cost, and duration. Branch, fork, and diff your agent's decisions.
  • Content Addressing:Each step's ID is the SHA-256 hash of its kind, inputs, and parent ID. Identical steps are deduplicated automatically.
  • Universal Models: Same Agent API for Anthropic, OpenAI, Google, Ollama, or anything via LiteLLM. Every adapter implements the Model protocol. Swap with one line.
  • Serializable: Save any run to a .tine JSON file via msgspec. Load it on any machine. Resume where you left off with Run.resume().
  • 250 Lines: The entire core (core.py) is exactly 250 lines. No magic, no framework overhead. Read it in 10 minutes.

What's Next

Read about Run Trees to understand the core abstraction, or jump to the Quickstart for a hands-on walkthrough.