Daytona

Build a research agent that reads the live web with Anakin and analyzes it in a Daytona sandbox with no API keys and no outbound network.

Daytona runs code in isolated sandboxes. Paired with Anakin, you get an agent that pulls live web data and then runs real analysis on it, without letting model-written code near your machine or your keys.

The official guide lives in Daytona's guides repo: a research agent that answers a question from the live web and writes a cited Markdown report with charts.

Guidedaytona/guides → python/anakin/research-agent
TypeRunnable example project
LanguagePython 3.10 to 3.14 (tested on 3.12)
Anakin packageanakin-sdk >=0.2.0,<0.3.0
Other dependenciesdaytona, litellm, python-dotenv
LLMAny LiteLLM model with tool calling. Default: Anthropic

Why the sandbox matters

Scraped pages are untrusted, and they shape the code the model writes. So the guide splits the work:

  • Your machine runs the agent loop and holds every API key. It calls Anakin and the LLM.
  • The Daytona sandbox runs the model's Python. It has no API keys and no outbound network (network_block_all=True). It only ever sees the scraped text.
Your machine (agent loop + all API keys)              Daytona sandbox (no keys, no network)
────────────────────────────────────────              ─────────────────────────────────────
LLM ─► web_search   ─► Anakin Search
    ─► scrape_pages ─► Anakin batch scrape ─► upload ─► /home/daytona/sources/page-001.md ...
    ─► run_python   ─────────────────────────────────► python reads sources, computes,
                                                       saves charts to /home/daytona/output/
report.md + charts ◄──────────── download ◄─────────── /home/daytona/output/

The model only sees a short preview of each page (1,500 characters). To use a source it has to write code that reads the full file, so the sandbox does real work on every run.


Quickstart

1. Get your keys

VariableRequiredWhere to get it
ANAKIN_API_KEYYesanakin.io/signup, then your Dashboard (starts with ask_)
DAYTONA_API_KEYYesDaytona Dashboard
ANTHROPIC_API_KEYFor the default modelAnthropic Console
RESEARCH_MODELNoAny LiteLLM tool-calling model, such as openai/<model>. Set that provider's key instead of ANTHROPIC_API_KEY
RESEARCH_MAX_TURNSNoMost model calls per run. Defaults to 20

2. Clone and install

git clone https://github.com/daytona/guides.git
cd guides/python/anakin/research-agent

python3 -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate
pip install -e .

3. Add your keys

cp .env.example .env
# then edit .env with your keys

4. Run it

# The default question: model vector database pricing and chart it
python research_agent.py

# Or ask your own
python research_agent.py "Compare the free tiers of the top 3 serverless Postgres providers"

Each run saves report.md and any charts in a new timestamped folder under output/.

In the guide's test run, the default question took about 3.5 minutes and 15 turns, with 6 searches and 18 scraped pages. LiteLLM estimated the LLM cost at $0.40, and the script prints that estimate at the end of every run. Anakin credits for the searches and scrapes are billed separately (see Pricing). Runs vary, so set RESEARCH_MAX_TURNS lower to cap the cost.


The agent's tools

ToolRuns onWhat it does
web_searchYour machineAnakin Search. Returns the title, URL, and snippet of each result (1 to 20 results)
scrape_pagesYour machine, then the sandboxAnakin batch scrape of up to 10 URLs. Uploads each page's full Markdown to the sandbox and returns the file path plus a preview
run_pythonThe sandboxRuns model-written Python (120 s timeout). Returns the exit code and output, capped at 8,000 characters

Here is the Anakin side of the guide. Search and scrape both use the Python SDK:

from anakin import Anakin

class ResearchTools:
    def web_search(self, query: str, limit: int = 5) -> str:
        results = self.anakin.search(query, limit=limit).results
        return json.dumps([{"title": r.title, "url": r.url, "snippet": r.snippet} for r in results])

    def scrape_pages(self, urls: list[str], use_browser: bool = False) -> str:
        batch = self.anakin.scrape_batch(urls, use_browser=use_browser)
        pages = []
        for item in batch.results:
            if not item.markdown:
                pages.append({"url": item.url, "error": item.error or "The page returned no content."})
                continue
            self.pages_saved += 1
            path = f"/home/daytona/sources/page-{self.pages_saved:03d}.md"
            self.sandbox.fs.upload_file(item.markdown.encode(), path)
            pages.append({
                "url": item.url,
                "path": path,
                "characters": len(item.markdown),
                "untrusted_preview": item.markdown[:1500],
            })
        return json.dumps(pages)

And the sandbox: no env_vars are passed, so no key reaches it, and it is ephemeral, so it cleans itself up even if the script is killed.

from daytona import CreateSandboxFromSnapshotParams, Daytona

daytona = Daytona()
sandbox = daytona.create(
    CreateSandboxFromSnapshotParams(language="python", network_block_all=True, ephemeral=True)
)
try:
    with Anakin() as anakin:
        report = run_agent(question, ResearchTools(anakin, sandbox))
    save_report(report, sandbox)
finally:
    daytona.delete(sandbox)

How a run works

  1. Sandbox. The script creates a Python sandbox with no outbound network, then creates its sources and output folders.
  2. Search. The model calls web_search, which runs Anakin Search on your machine.
  3. Scrape. The model calls scrape_pages. Anakin's batch scraper fetches the pages on your machine, the full Markdown is uploaded to the sandbox, and the model gets back paths and previews.
  4. Analyze. The model calls run_python to search the files, pull out figures, and build charts. Errors go back to the model so it can fix its code.
  5. Report. When the model replies without a tool call, the script saves the report and downloads everything in the sandbox's output folder.
  6. Cleanup. The sandbox is deleted, even if the run fails.

If the run reaches its turn limit, the last turn forces the model to write the report from what it has and say what it couldn't verify, so you still get a result.


Use cases

The pattern fits any question where the answer needs numbers from several web pages plus some computation on top. Some questions to try:

  • Pricing models. The default question: compare Pinecone, Weaviate Cloud, Qdrant Cloud, and Zilliz Cloud pricing, model the monthly cost of 1M, 10M, and 100M vectors on each, and chart it.
  • Free tier comparisons. "Compare the free tiers of the top 3 serverless Postgres providers."
  • Competitor research. "Compare the published rate limits and per-request prices of the top 5 web search APIs, and chart cost per 10,000 requests."
  • Market sizing. "Collect the latest reported revenue for the top 5 public CDN companies and chart year-over-year growth."
  • Fact checking. "Check the benchmark numbers in this announcement against each vendor's own published results."

Every figure in the report has to cite its source URL, and the report has to state its assumptions and what it couldn't verify.


Customizing the guide

ChangeHow
Use another LLMSet RESEARCH_MODEL to any LiteLLM tool-calling model and set that provider's key
Cap costLower RESEARCH_MAX_TURNS
JavaScript-heavy sourcesThe model can already pass use_browser=true to scrape_pages. Mention it in the system prompt if your sources are mostly SPAs
Country-specific datascrape_batch also accepts country=. Add it to the scrape_pages tool schema to let the model choose, or hard-code one
Structured datascrape_batch also accepts generate_json=True for AI-extracted JSON next to the Markdown

Security notes

  • Isolation limits what model-written code can do. It doesn't stop prompt injection. A malicious page could still mislead the model and skew the report, so check the cited sources before you rely on a result.
  • Keep ANAKIN_API_KEY set. Without a key, the Anakin SDK runs in keyless mode, where search isn't available, so the script stops before it creates a sandbox.
  • Check your Daytona tier. The guide was tested on one Daytona account, where network_block_all=True blocked outbound requests. Daytona's docs say Tier 1 and 2 network rules can't be overridden per sandbox, so confirm the behavior on your tier in Daytona network limits.

Learn more


Stay updated