Deep research agentic loop with rig AgentRunner + Gemma models #2
Loading…
Reference in a new issue
No description provided.
Delete branch "worktree-deep-research-agent"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
rigto the newest published crates.io release (0.41.0) instead of thegit branch = "main"dependency, and adaptsswear_cleanup/revise.rsto that release's API (OneOrMany::first()returnsTdirectly;raw_completionfolded intoCompletionResponse::raw_response).src/deep_research/— a lean, three-agent research pipeline built on rig'sAgentRunnertool-calling loop and typedExtractor, using local Gemma models via Ollama for different sub-tasks:researcher(gemma4:26b) — drives rig's tool-calling loop (agent.runner(topic).max_turns(12).run()) with two#[rig::tool_macro]tools:search_web(DuckDuckGo HTML search, no API key) andfetch_page(fetch + strip to readable text). Cross-checks claims across sources and dumps raw findings.reviewer(gemma4-e4b, fresh context) — uses rig's typedExtractorto force a structuredsubmit(Review)call judging whether the findings' conclusions are actually backed by their cited sources, split intosolid_findingsto keep andgapsto close.writer(gemma4-e4b) — turns approved findings into a structured, source-cited report.research()is a plain bounded loop (for round in 1..=MAX_RESEARCH_ROUNDS) — matches rig's own workflow guidance ("the least agentic design that solves your problem"): code stays in control of the retry/stop decision, feeding the reviewer'ssolid_findings/gapsinto the next round's task so the researcher builds on what worked instead of restarting blind.#[tracing::instrument]spans wrap each phase (gather_findings/review_findings/write_report), nesting rig's ownchat/execute_toolspans underneath; agents are named (.name(...)) sogen_ai.agent.nameis attributable instead of"Unnamed Agent".Test plan
cargo build— clean, no errorscargo clippy --all-targets— no warnings on new codegemma4:26b,gemma4-e4b) verifying: tool calls fire correctly, reviewer approves/rejects with structured feedback, retry loop reruns research with feedback folded in, final report includes headings and inline source citations