Investigative research agents

The new research system, much more advanced than the simple agent: a frontier of questions with a notes file, claims verified against independent sources and challenged adversarially, gates and circuit-breakers in code, and a separate synthesis phase. Runs, states, agent definitions, the API, cost and isolation are shared with the simple agents and described on the main page.

Why a different loop

The simple loop is a conversation that only grows and that ends when the model writes text instead of calling a tool. For a deep investigation that fails in four ways. The investigative loop turns the agent into an investigator: it keeps explicit state, decides what to find out next, acts, observes and updates that state, tests hypotheses, triangulates sources and corrects itself.

Failure of a plain loopCauseAnswer in the investigative loop
Rabbit holes: it follows tangentsno explicit list of what is still to be found outthe question frontier: a bounded, prioritized, depth-capped queue
Premature termination: one vague article, then a reportstopping is implicitan explicit finalize_report tool behind gates, and a separate exploration / synthesis split
Context bloat: every snippet stays in the historynothing is droppedexternalized notes and context compaction
Unchecked claimsverification is only a line in the promptthe claim ledger and adversarial challenges

The rule of the design: everything that decides whether the loop continues (which question is next, dependencies, the depth and attempt caps, the breakers, the gates) is code, never the model’s judgement. The model decides content: what to ask, how to search, what an answer says and whether it meets the criteria. The core is functional: the frontier, the notes and the loop state are immutable values and every transition is a pure function, unit-tested without a model or a database; reads, writes and model calls happen at the edge.

The vocabulary

TermMeaning
Runone research (a row of gb_agent_research_runs); everything below is scoped to a run
Objectivethe topic of the run, and the root question of the frontier
Questionan unresolved query, hypothesis or knowledge gap: a node of the frontier graph
Frontierthe questions of a run with their edges (parent, dependencies): the boundary between what is known and what must be found next
Claim / datapointan atomic factual assertion with its sources and a verification status; a datapoint is a claim that is a number with a unit and context
Notesthe text scratchpad of the run, the agent’s working memory (notes.md)
Turn / iterationa turn is one model call plus the tools it asked for; an iteration is one pass of the cycle on one question, usually several turns
Circuit-breakera deterministic limit that ends the loop whatever the model wants

The question frontier

An explicit, prioritized queue of unresolved questions, treated as a best-first search over a knowledge space: every node is a question, every edge a retrieval step, and the frontier holds the candidate nodes waiting to be evaluated. It is also the termination criterion: exploration is finished when no actionable question remains (or a breaker fires). It lives in its own tables, outside the prompt and outside the notes; the model only touches it through tools.

A question

FieldMeaning
id, parent_id, depthq_001 is the root; ids and depth (parent.depth + 1) are assigned by code
kindquestion, or hypothesis (“X is true because Y”: the agent must search for both confirming and refuting evidence)
question, rationalethe question, and why it matters for the objective (what it unblocks)
priority0 to 1: how critical the answer is to the objective and to the questions that depend on it
validation_criteriawhat counts as an acceptable answer; required before the question can be resolved
target_sourcesthe kinds of source to look for (benchmarks, source_code, official_docs, ...)
depends_onedges to other questions. A question is actionable only when every dependency is resolved; dependencies form a DAG and an edge that would close a cycle is rejected
attempt logone row per query tried on the question (query, tool, one-line outcome): what the agent sees as “already tried”, and what drives the dead-end rule
answerresolved: the answer with claim ids; unresolvable: the assumption made; pruned: the reason

Lifecycle

pendingin_progressresolvedblockedunresolvableprunedfrontier_next (selected)retry_question (inconclusive)resolve_questionreopen_question (a later finding contradicts the answer)max_attempts reached (an assumption is logged)a dependency faileddependency resolvedprune_branch · depth cap · out of scope: from pending / blocked, with the reason kept
The status of a question. Every change is a new row of an append-only transitions table, with who did it (agent or code), why, and what caused it.
  • pending: waiting in the queue. in_progress: selected (at most max_parallel at a time, 1 today).
  • resolved: the validation criteria are met. The code checks that the cited claims exist and are at least UNVERIFIED, and that a hypothesis has both a confirming and a refuting search in its attempt log.
  • blocked: a dependency can never be satisfied (it was pruned or is unresolvable); the agent must rewrite or drop the question.
  • unresolvable: failed after max_attempts (4) distinct reformulations. It is not retried; the gap and the assumption made go into the report.
  • pruned: dropped from the search with a reason. Terminal, but kept for the audit trail.

Selection: a pure function

Among the pending questions whose dependencies are all resolved, take the highest priority; ties go to the lower depth (broader first), then to the older one. If the best question is not actionable because of an unresolved dependency, the dependency is considered first and its priority is raised to at least the dependant’s, so unblocking work is never starved. Selecting sets in_progress. The model is then told the question, its rationale, criteria and the queries already tried.

Growing and shrinking the graph

Broad query expansion

At the start the agent expands the objective into the first level of sub-questions (typically 3 to 8, each with criteria and priority) before the first search. The first frontier_next is refused until the root has a child (or the agent states the objective is atomic).

Branching

add_question creates a child of the current question when a page brings a contradiction, an unexpected dependency or a knowledge gap that blocks the criteria. The code assigns the id and depth, rejects a node deeper than max_depth (3), a near-duplicate, and anything past max_questions (40). A child that unblocks the current question gets at least its priority: an anomaly is resolved before the agent moves on.

Pruning

prune_branch drops a question and all its pending or blocked descendants when an answer makes the branch irrelevant (a library found deprecated removes every question about configuring it). The prompt says to prune whatever would not alter the top-level conclusion; the reason is stored.

Re-prioritization

set_priority by the agent, and mechanical re-ranking by the code: raising a question raises the floor of its dependencies, resolving one unblocks its dependants, and a pruned branch removes its weight from its ancestors.

Frontier tools

ToolPurpose
frontier_next()select the next question (the pure function above) and mark it in_progress
frontier_view(status?, id?)inspect questions (compact), or one with its attempt log
add_question(parent_id, question, rationale, priority, validation_criteria, target_sources, depends_on?, kind?)expand the graph
retry_question(id, new_query, why)record an inconclusive attempt and mutate the query; the code rejects a query that is not different from the earlier ones, and at max_attempts makes the question unresolvable and asks for the assumption
resolve_question(id, answer, claim_ids)mark it resolved
reopen_question(id, why, priority?)self-correction: re-enter the queue with raised priority
set_priority(id, priority, why)re-prioritize
prune_branch(id, reason)scope pruning

Every tool returns the updated compact summary of the questions it touched. The full frontier is never dumped into the prompt, only the summary.

The update loop

Each iteration is state, decide, act, observe, update. The loop ends only by finalize_report or a circuit-breaker: a turn where the model answers in plain text and calls no tool is not an end, the loop reminds it of the open frontier and goes on.

1. Statecodeprompt = task, tools,notes, frontier summary,last 2 turns2. Decidecode + modelcode selects the question;model plans the query tomeet its criteria3. Actmodel + toolsweb_search, fetch_page,query, frontier andnotes tools4. Observecode + modelbig result: forcedextraction, then judgevs. validation criteria5. Updatemodel + coderesolve / retry / add /prune; code counts, blocks,re-ranks, checks breakersnext iteration: the prompt is rebuilt from the updated notes and frontier (nothing accumulates)one iteration = one pass on one question, usually a few turnsa breaker check runs before every model call; the loop ends only by finish_exploration + finalize_report, or a breaker
One iteration of the cycle. The orange line under each title says who does the step: the code, the model, or both.

1. State

The prompt is built from the task (the objective), the tool definitions, the current notes, the frontier summary and the last 1 to 2 turns of raw tool input and output. Nothing else.

2. Decide

Code selects the question. The model formulates the next action to satisfy its validation criteria, not generic browsing.

3. Act

The model calls web_search, fetch_page, query, and the frontier and notes tools.

4. Observe

A large page triggers the forced extraction before anything else. The model then judges what it has against the criteria.

5. Update

The model records the outcome through tools (resolve, retry, spawn children, record claims). The code applies the deterministic parts (attempt counting, blocking, pruning, re-ranking), runs the breaker check and starts the next iteration.

Hypothesis testing, triangulation, self-correction

No extra machinery: they are uses of the frontier and the claim ledger.

Hypothesis testing

A hypothesis states what would confirm it and what would refute it, and the agent searches for both: one query for confirming evidence and an adversarial one for refuting evidence.

Source triangulation

A claim becomes VERIFIED only with at least min_independent_sources (2) independent sources (a different registrable domain, not one quoting the other). One source alone leaves it UNVERIFIED.

Self-correction

A claim can be REFUTED or RETRACTED, a resolved question can be reopened when a later finding contradicts it, and a refuted claim spawns a high-priority question. Revisions are appended, never overwritten, so the history stays auditable.

The notes: the agent’s working memory

The frontier is control flow; the notes hold knowledge and reasoning. It is a text file the agent always has in its prompt and edits only through tools, so a model slip cannot erase verified work.

notes_<user>_<run>_<notes_id>.md
# Notes: <objective>

## Verified           (claims with status VERIFIED)
- [c_007] VERIFIED  The model needs 11.2 GB at fp16.  src: s_3, s_5
## Unverified         (awaiting cross-check; each lists what would verify it)
- [c_009] UNVERIFIED  Skip connections add ~18% memory.  src: s_4  | check: independent benchmark
## Contradictions     (conflicts, with the question spawned to resolve them)
- c_007 vs c_011 -> q_044
## Datapoints         (numbers with unit and context)
- [d_002] 16 GB | VRAM budget of the target GPU | s_1
## Sources            (id, URL, title, access note, domain)
- [s_3] https://... "Title" (arxiv.org)
## Assumptions & gaps (unresolvable questions and the assumptions made)
- q_031 unresolvable: no public figure found; assumed ~2x of baseline
## Scratch            (free text: reasoning, plans; bounded size)

Fixed grammar, edited by tools

One record per line, so the gates and the compaction read it with a pure parser (only Scratch is free text). Ids (c_, d_, s_) are assigned by code. Edits are notes_append, notes_update (change a status, add a source, retract) and notes_scratch.

Size bound

A budget of notes_max_tokens (6000). Over it, the loop forces a consolidation turn (merge duplicates, shorten Scratch, move the settled to Verified) before going on. That keeps the prompt bounded.

A file plus a history

The working copy is a file written atomically (temp file and rename); the file name has a random 128-bit id, so two servers sharing a directory cannot overwrite each other. Every write also adds a full copy to gb_agent_notes_versions in the same transaction as the claim, source and transition rows it changes. A missing or stale file is restored from the latest version.

Optional S3 mirror

With research_notes_s3_bucket set, every write is also put to s3://<bucket>/<prefix>/<user>/notes_...md (one research bucket, a subdirectory per user), and a file missing locally is read back from it.

Extraction and context compaction

The prompt of a turn is rebuilt, not accumulated. Its size is bounded by task + tools + notes (≤ notes_max_tokens) + frontier summary + 2 turns, not by the number of turns so far, so a run can have far more turns than the 20 or 40 steps of the simple loop.

Forced extraction

When a fetch_page (the richer successor of fetch_url) or any other tool result is larger than extraction_threshold (4,000 characters), the loop does not let the agent go on with the raw text in the conversation:

  1. The next turn is restricted to the notes tools, with the instruction “extract what matters for question q_xxx from this page”.
  2. The agent records atomic claims, numeric datapoints and the source with its title (claims start UNVERIFIED, linked to the source).
  3. When the turn ends, the raw text may be evicted. A page with nothing useful is recorded as a source with “read, nothing relevant”, so it is not fetched again.

What the prompt holds

Kept

the system prompt and the tool definitions; the task; the scratchpad (the current notes and the frontier summary); the last keep_turns (2) turns of raw tool input and output.

Evicted

everything older. A tool output is evicted only once committed: its useful content is in the notes, or the loop has recorded that nothing in it is useful. The attempt log keeps the queries and a one-line outcome, so the agent still knows what it tried. Uncommitted results are never evicted.

frontier summary in the prompt
Frontier: 7 resolved, 5 pending, 1 unresolvable, 3 pruned  (max_depth 3)
Current: [q_042] (P 0.85, depth 2) <question>
  criteria: <validation_criteria>
  tried: "<query 1>", "<query 2>"
Next up:
- [q_043] (P 0.80) ...
- [q_050] (P 0.55) ...
Blocked: [q_051] waits on q_042
Open challenges: ch_004 (claim c_009)

Claims, verification and adversarial challenges

What the report may say is decided by a ledger, not by the model’s confidence. A claim has an id, a text, a status, its source ids, supports / contradicts links to other claims and the question that produced it.

StatusMeaning
UNVERIFIEDrecorded from a primary source, not cross-checked
VERIFIEDsupported by at least min_independent_sources independent sources and at least min_challenges (1) adversarial challenges that it survived; the code checks both, the model cannot mark it with fewer
REFUTEDcredible independent evidence contradicts it
RETRACTEDthe agent withdrew it (source found unreliable or misread)

Only VERIFIED claims, and explicitly flagged UNVERIFIED ones, can appear in the report. Contradicting evidence sets a contradicts link, moves the claim to REFUTED or leaves both in Contradictions, and spawns a high-priority question.

Adversarial queries

A challenge is a search whose purpose is to find evidence against something the agent believes. A query that would return the same pages as the one that produced the claim is not a challenge. Every challenge is a row of gb_agent_challenges, so how the model attacks its own facts can be inspected afterwards.

A claim

challenged when it is UNVERIFIED and matters to a question’s criteria, and again before it can count as VERIFIED if its sources share an origin.

A question answer

challenged before resolve_question is accepted for a question of depth 0 or 1 (the ones that carry the conclusion).

The conclusion

challenged once at the end of exploration. This keeps the agent from stopping on the first plausible story.

The model does not write the query directly. It states first, in structured fields, what it attacks and how: the negation (the belief inverted into the statement to prove), a strategy, the expected_if_false (what the evidence would look like if the belief were wrong, written before the search, so the result is judged without bias) and then the query, built from the negation, not from the original wording.

StrategyThe query aims at
negationthe opposite statement
discrepancya different figure or date for the same quantity
criticismknown problems, retractions, errata
alternative_methodanother measurement, dataset or methodology that could give another result
scope_limitconditions under which the claim fails (version, hardware, population, time)
primary_sourcethe original source behind a secondary claim, to see whether it says so
stalenessnewer information that supersedes the claim

Code rejects a challenge that is not adversarial: the target and a strategy must be named with at least one expected_if_false; the query must differ from every earlier query on the question and the target (normalized, a rephrasing is rejected) and must contain terms of the negation that the claim text does not; the same strategy is not used twice on a target, and at most max_challenges_per_target (3) are allowed. It then runs as a normal search and is written to the question’s attempt log.

OutcomeMeaningEffect
survivednothing credible against the target was foundcounts toward verification
weakenedqualifications, a narrower scope or a lower-quality counter-sourcethe target is amended (the scope goes into the claim) and is re-verified; needs a cited source
refutedcredible independent evidence contradicts itclaim REFUTED, a high-priority question is spawned, the answer or conclusion is reopened, and every question that cited the claim is reopened by code; needs a cited source
inconclusivenothing usable either wayanother strategy is allowed (up to the cap); never counts as survived

Tools

challenge(...) validates and registers a challenge (and runs nothing itself); the agent then searches with the registered query. record_challenge_result(challenge_id, outcome, evidence, source_ids, result_claim_id?) closes it. challenges_view lists them.

Never forgotten

A challenge is open between the two calls. Open challenges appear in the frontier summary, and the loop will not start finish_exploration with one open.

Analysable

Because strategy, negation, query, outcome and evidence are structured, you can ask how often the agent challenges at all, which strategies find refutations, and whether the challenges are real or token (all survived, all the same strategy).

Two loops: explore, then write

To prevent premature termination, a research is two loops run one after the other, with different tools, prompts and goals.

Exploration loopphase = explorationthe cycle on the frontier; web, knowledge,frontier, notes and challenge toolsExploration gatefinish_explorationSynthesis loopphase = synthesisno search tools; notes + frontierin, report outReportfinalize_reportpassesfails: what is missing is listedcircuit-breaker (cost, tokens, turns) or frontier exhausted: straight to synthesis, with the cut as a notesynthesis finds a hole that changes the conclusion: reopen a question (max_reopens = 1)
Exploration ends by its gate or a breaker; synthesis ends by finalize_report. The three arrows back and aside are the cases the code handles without the model’s consent.

Exploration loop

Gather and validate evidence until the frontier is exhausted. Tools: web and knowledge tools, frontier, notes and challenge tools, finish_exploration. The model cannot write the report here. It ends when the gate passes, when no actionable question is left (after a final check that queues any UNVERIFIED claim relevant to a resolved question), or when a breaker fires.

Synthesis loop

Write the report from the notes and the frontier, with no new research. Input: the objective, the notes (verified claims, datapoints, sources, contradictions, assumptions and gaps) and the frontier including unresolvable and pruned questions with reasons. Tools: notes_read, frontier_view, finalize_report. A hole it cannot fill must be stated in the report; one that would change the conclusion may reopen exploration once (max_reopens).

The report

Summary first, then details, then the source list, plus a section of gaps and assumptions taken from unresolvable questions and the verification status of key claims. Every statement is traceable to claim and source ids, rendered as URLs.

The gates

Deterministic checks in code. When one fails, the tool returns an error listing what is missing, so the model cannot end the work by saying so.

finish_exploration

  • the root question is resolved, or unresolvable with a stated assumption
  • no actionable pending question with priority ≥ gate_priority (0.5)
  • at least min_sources (5) distinct sources from at least min_domains (3) domains
  • every resolved question cites a VERIFIED claim, or states why UNVERIFIED is the best available
  • no unaddressed entry in Contradictions
  • no open challenge, and the conclusion has a closed challenge that survived (after weakened or refuted exploration goes on)

finalize_report

  • the report cites only existing source ids
  • every unresolvable question appears under gaps
  • nothing in it contradicts a REFUTED claim (checked by claim-id references, not by text analysis)

It is the only normal way for a run to complete, and the text passed is the report stored in gb_agent_research_reports, next to a summary that one separate model call writes at the end.

Circuit-breakers

Checked by code before every model call. None depends on the model’s cooperation.

BreakerDefaultEffect
max_steps60 turns (2 to 300 for this loop; the simple loop has 1 to 40)ends the phase
max_depth3not a stop: deeper questions are never created
max_attempts per question4the question becomes unresolvable
max_questions40no more nodes: the agent must prune or resolve
max_total_tokensno limitends the phase
cost budgetmax_cost_usd of the definition, request or server (the lowest counts)ends the phase
wall clocktimeoutthe run ends

When a breaker fires during exploration the run does not fail: it moves to synthesis, with a note in the notes and the report that the investigation was cut short and by what (breaker:cost), listing the still-pending questions as open gaps. Synthesis has its own synthesis_reserve (15% of the turn, token and cost limits) that exploration cannot spend, so a report can always be written. If even the reserve is used up, the run fails and names the breaker. The last turn is always forced to call finalize_report (tool_choice on it), instead of the “last step has no tools” of the simple loop.

Everything is in tables

A run of this loop can be read back with plain SQL, replayed, charted and exported. All tables are scoped to the run and deleted with it.

TableHolds
gb_agent_frontier_questionsone row per question (the current value)
gb_agent_frontier_depsthe dependency edges (a DAG)
gb_agent_frontier_attemptsappend-only: every query tried on a question, with its outcome
gb_agent_frontier_transitionsappend-only: one row per status change, with the old and new status, the trigger, whether the agent or a code rule did it, the reason, the priority and attempts at that moment, and the question or challenge that caused it. Replaying it rebuilds the history of the whole search
gb_agent_sources, gb_agent_claims, gb_agent_claim_sourcesthe sources read (with their domain, for the independence check), the claims and datapoints, and the supports / contradicts links
gb_agent_challenges, gb_agent_challenge_sourcesevery adversarial query with its target, strategy, outcome, evidence and cited sources
gb_agent_notes_versionsappend-only: the whole notes file after each write

Run fields

phase (exploration or synthesis), stop_reason (finalized, frontier_exhausted, breaker:steps, breaker:tokens, breaker:cost) and notes_id. steps counts turns.

Extra states

planning, selecting (no model call), delegating and waiting (workers), extracting, verifying, challenging, consolidating and synthesizing, besides the usual ones. A turn’s detail reads turn 7 of 60, question q_003.

What you can ask

time spent per status; questions that were reopened; the resolved-versus-unresolvable ratio per depth; what the code pruned versus the agent; challenges per strategy and their outcome distribution (a run where every challenge survived with one strategy is suspect); the refutations with their sources.

ATIF trajectory

One agent step per model call, with the turn, its kind, the state, the phase and the question id; the phase and stop reason are in the trajectory result.

Sub-agents: workers on the frontier

With max_parallel above 1 the code of the loop hands independent questions to workers, sub-agents that each research one question on a clean context and hand back distilled findings. The model has no tool to start a worker. Only the supervisor (the loop) writes the frontier, the notes and the claim ledger, so there are no concurrent writers.

Select, mark, run, reduce

A pure function picks the pending questions whose dependencies are resolved (highest priority first, up to max_parallel); the loop marks them in_progress (trigger delegated), runs one worker for each in parallel and waits for all of them. A worker ends with the terminal tool submit_findings (an answered, partial or failed outcome with claims and their sources, the queries tried and the gaps it found); a pure reducer applies it to the frontier, the notes and the claims.

Claims still need the gate

A worker’s claims enter as UNVERIFIED; VERIFIED is reached only through the supervisor’s challenges. A gap becomes a child question added by code. An answer resolves its question only if the checks of resolve_question pass; otherwise the question stays in progress for the supervisor. A worker that fails does not fail the research: its question goes back to pending, and becomes unresolvable at the attempt cap.

Tracked like any run

A worker is a run with its own states, usage, cost_usd and report (its findings, a row of gb_agent_research_reports), and a parent_id, a name (its question id) and a reason; GET /v1/gb/research?parent_id= lists them. The supervisor shows the states delegating and waiting. Its trajectory merges the workers’ steps, each tagged with its agent.

Limits and cost

One level: workers get no tool to start workers. A worker’s cost counts for the supervisor’s breakers and a cost cap of the research counts all the agents; before a fan-out the loop does not delegate once exploration has spent 60% of its budget, and each worker gets a share of what exploration may still spend. When the supervisor ends, its workers are cancelled; stopping one worker only sends its question back to the frontier.

Workers run on the supervisor’s model and dataset with its tools, and with run_code when the definition has [code] on. Knobs in [investigate]: max_parallel (1 to 8, 1 = none), worker_max_steps (12), worker_context_tokens (1500), max_workers (20) and min_priority_to_delegate (0). Design and contract: the sub-agents guide.

Using and tuning it

Set loop = "investigative" in an agent definition; the rest of the definition (prompt, skills, search and knowledge settings, cost caps) works as usual, and fetch_url is called fetch_page for the model. The knobs are the [investigate] table, every one optional; the table is an error with the simple loop, and a research can override it with an investigate object in POST /v1/gb/research.

agent_defs/deep.toml
loop = "investigative"
max_steps = 60                    # turns of the run, 2 to 300 (top level, not in [investigate])
[investigate]
max_total_tokens = 0             # 0 = no limit
synthesis_reserve = 0.15         # share of each limit that exploration cannot spend
max_depth = 3                    # 1 to 6: how deep the question tree goes
max_attempts = 4                 # formulations before a question is unresolvable
max_questions = 40
keep_turns = 2                   # recent turns kept in the prompt, 1 to 5
extraction_threshold = 4000      # characters that force an extraction turn
notes_max_tokens = 6000          # over this: a consolidation turn
min_sources = 5                  # exploration gate
min_domains = 3
min_independent_sources = 2      # for VERIFIED
min_challenges = 1               # survived challenges for VERIFIED
max_challenges_per_target = 3
gate_priority = 0.5
max_reopens = 1                  # times synthesis may send the run back to exploration
max_parallel = 1                 # 1 to 8 workers (sub-agents) at once; 1 = none
worker_max_steps = 12            # model calls of a worker, 1 to 40
worker_context_tokens = 1500     # notes slice in a worker’s brief
max_workers = 20                 # workers in the whole run, 1 to 40
min_priority_to_delegate = 0     # a question below this is not delegated

It runs sub-agents only through max_parallel (the [spawn] table was removed), and runner: "modal" is an error with it. max_steps is its limit of turns too, with the range 2 to 300. The run is started, listed and read like any other (REST, MCP and the CLI) and followed in the admin UI. Design notes: the deep-research loop docs.

Code execution: run_code

An investigative agent can run a short Python program in a sandbox (Pydantic Monty, in a sidecar process) for exact arithmetic, unit conversions, counting and parsing a long text, and reads back only what the program prints. It is opt in: [code] enabled = true in the definition (an error with the simple loop). It is offered in the exploration and planning turns only; a run is stateless and cannot change the frontier, the notes or the claims.

Host functions

The program can call a fixed registry of Go functions: notes_read, frontier_get, frontier_list, claims_list, fetch_page, web_search, kb_query and log. The fetch ones run the agent’s own tools, so their limits, domain rules and cost apply. Workers get run_code too, without the functions that read the supervisor’s state (notes_read, frontier_*, claims_list).

Limits and setup

The [code] table sets timeout_s, max_memory_mb, max_recursion, max_output_chars, max_calls, max_host_calls, max_result_chars, functions and type_check. The Docker image has Monty; otherwise install pydantic-monty and set monty_python / monty_bin. Without it the sandbox is not created and the agent runs without run_code. Each call is recorded in extra.code_runs of the trajectory step.

Not included yet