Research agent
This native example combines the separate search and protected fetch modules and keeps a crash-safe draft.
Terminal
pip install "opentine[anthropic]"
export ANTHROPIC_API_KEY="..."
# Optional: TAVILY_API_KEY, EXA_API_KEY, or BRAVE_API_KEYresearch.py
1from opentine import Agent
2from opentine.models.anthropic import Anthropic
3from opentine.tools.search import search
4from opentine.tools.web import fetch
5
6agent = Agent(
7 model=Anthropic("claude-sonnet-5"),
8 tools=[search, fetch],
9 system="Search authoritative sources, synthesize them, and include URLs.",
10 max_steps=30,
11 autosave_path="research-draft.tine",
12 autosave_every_n_steps=1,
13)
14run = agent.run_sync("Research content-addressed provenance for agent runs")
15run.save("research.tine")
16print(run.status, run.total_cost, run.total_tokens)
Inspect
Terminal
tine show research.tine
tine verify research.tine
tine cost research.tineContinue from context
revise.py
1from opentine import Run
2
3source = Run.load("research.tine")
4revised = agent.resume_sync(
5 source,
6 from_step=source.steps[-2].id,
7 prompt="Continue, focusing on operational failure recovery.",
8)
9revised.save("research-revised.tine")
The selected step and ancestors are retained; the new prompt starts a new continuation.