How to Build an AI Research Agent with Claude Code in 2026
Step-by-step tutorial for building a multi-step AI research agent using only Claude Code, a project-level CLAUDE.md operating brief, and a tight permission allowlist. The example agent fetches web pages, extracts claims, cross-checks against a second source, and writes a structured Markdown report. Tested on Claude Sonnet as of April 2026.
Overview
Claude Code is Anthropic's official command-line interface for Claude. Although marketed primarily as a coding assistant, the CLI accepts arbitrary instructions and can read files, run shell commands, and call out to other tools, which makes it a practical scaffold for building lightweight research agents. This tutorial walks through building a multi-step AI research agent using only Claude Code, a project-level CLAUDE.md, and a small handful of permitted Bash commands.
The example agent fetches recent web pages on a topic, extracts key claims, cross-checks them against a second source, and writes a structured Markdown report. The same pattern extends to competitive intelligence, internal knowledge base updates, and audit-style reviews.
Prerequisites
- Claude Code installed and authenticated (
npm install -g @anthropic-ai/claude-codethenclaude auth) - An Anthropic account with API access or a Claude Pro/Max subscription that includes Claude Code
curlandpandocavailable on the PATH (used to fetch and clean web pages)- A working directory dedicated to the agent's outputs
Step 1: Create the Project Skeleton
mkdir -p ~/agents/research-agent/{sources,reports}
cd ~/agents/research-agent
touch CLAUDE.md
mkdir .claude && touch .claude/settings.json
Step 2: Write CLAUDE.md
The CLAUDE.md file is the agent's standing brief. Claude reads it at the start of every session and treats its instructions as the project rulebook.
# Research Agent — Operating Brief
## Mission
Produce a balanced, citation-backed Markdown report on the topic the user names.
Reports go in `reports/<slug>.md`. Source material goes in `sources/<slug>/`.
## Method
1. List 3-5 candidate URLs that cover the topic from different angles.
2. Use `curl` + `pandoc -f html -t plain` to fetch each URL into `sources/<slug>/<n>.txt`.
3. Read each file. Extract claims as a bullet list.
4. For every claim, cite the source URL inline.
5. Cross-check load-bearing claims against a second source. Flag any disagreement.
6. Write `reports/<slug>.md` with: Summary, Key Claims, Disagreements, Open Questions, Sources.
## Rules
- Do not invent URLs. If a fetch fails, report the failure and pick another candidate.
- Always include the date the page was fetched ("retrieved YYYY-MM-DD").
- Keep tone encyclopedic; avoid marketing language.
- Stop and ask the user before making more than 8 outbound HTTP requests.
Step 3: Lock Down Permissions
Put a tight allowlist in .claude/settings.json so the agent does not stop to ask before each safe command:
{
"permissions": {
"allow": [
"Read",
"Write",
"Edit",
"Bash(curl:*)",
"Bash(pandoc:*)",
"Bash(ls:*)",
"Bash(mkdir:*)"
]
}
}
Anything not on this list still prompts. That keeps the agent unable to run, for example, rm -rf without explicit consent.
Step 4: Run the Agent
From the project directory:
claude "Research the current state of open-source workflow engines. Slug: oss-workflow-engines."
Claude Code reads CLAUDE.md, drafts the candidate URL list, fetches each page through the allowlisted curl, and writes the cleaned text to sources/oss-workflow-engines/. It then reads the files back, extracts claims, cross-checks the load-bearing ones, and writes reports/oss-workflow-engines.md.
Step 5: Iterate
Refine CLAUDE.md after each run. Common upgrades:
- Add a "Stop conditions" section that lists when to abort (paywalled site, geo-blocked content, contradictory data).
- Add an "Output schema" section with the exact Markdown headings expected, so reports stay comparable.
- Record the model and date at the top of each report so older outputs do not get mistaken for current ones.
Cost Notes
A single research run on Claude Sonnet using the agent above typically reads 5-8 pages, runs ~15 tool calls, and produces a 600-900 word report. As of April 2026 that costs roughly $0.10-$0.30 in API spend per run on the Anthropic API. Pro and Max subscribers running the same prompt against the included quota pay nothing per run, subject to the rate limit on their plan.
See the Claude Code tool page for the current entitlement matrix and the How to Set Up Claude Code with VS Code tutorial for the editor-side companion. For agent platforms with a hosted runtime, see the Best AI Agent Tools ranking.
Editor's Note: We use a slightly more elaborate version of this agent at ShadowGen for client weekly intelligence briefs. The biggest practical lesson was forcing the agent to record retrieval dates inline; without that the same report could not be revised three months later because no one could tell which claims were stale. The cheapest model that still produced reliable cross-checks in our testing was Claude Sonnet, not Opus, mainly because cross-checking does not need long-form reasoning, just careful comparison.
Tools Mentioned
Related Guides
Moxo vs Gumloop in 2026: Texting the Client, or Building the Agent
Gumloop (founded 2023) builds AI agents a company's own staff run; Moxo, whose predecessor Moxtra was co-founded in 2012, runs processes that wait on people outside the company. Gumloop wins three rounds to two: the way in, per-tool gating and a priced overage. Moxo wins on…
Moxo vs Relay.app in 2026: Where Relay's Approval Workflows Can Go Next
Relay.app, founded in 2021, shut down in September 2026 and deleted every account, workflow and run history; Moxo, whose predecessor Moxtra was co-founded in 2012, is one destination for its human-in-the-loop users. Relay.app takes two rounds, Moxo one, and vendor risk is a draw…
Moxo vs Workato in 2026: The Integration Estate, or the Approval Inside It
Workato, founded in 2013, is an enterprise integration platform whose Workflow apps add human tasks to recipes; Moxo, whose predecessor Moxtra was co-founded in 2012, ships the human step itself. Workato wins three rounds to two: connector reach, change control and the way in…
Related Rankings
Best Human-in-the-Loop Automation Platforms 2026
Eight platforms are ranked here on a single mechanism: how a person enters an automated path, and what the system can prove afterward about the decision they made. Moxo scores 7.7 and ranks first; Camunda 8 scores 7.2, Microsoft Power Automate 7.1, Pega 6.9, n8n 6.7, Zapier 5.9…
Best Automation Platforms for AI Orchestration 2026
This ranking answers one question: how many real business applications can an AI agent act on out of the box? It evaluates nine platforms as of August 2026 on the reach they give an agent, not on the workflow logic they can express. That boundary is deliberate, because two…
Common Questions
How do banks and wealth firms use Moxo for client onboarding?
Moxo's financial-services page (read 13 October 2026) pitches account opening and KYC reviews as shared work: the client gets a secure link to see what is needed and sign, while relationship managers, compliance and operations staff review and approve inside one tracked flow. The…
Can healthcare teams run patient-facing workflows on Moxo?
Yes for coordination work, once a signed BAA is in hand: Moxo told Automation Atlas in writing on 6 October 2026 that it signs BAAs, but it publishes none and did not say which plans the agreement covers or whether it reaches Moxo AI. Moxo says it has no native EHR, HL7 or FHIR…
Who is accountable when an AI agent acts in a Moxo workflow?
The company that deploys the agent is accountable: Moxo's Terms and Conditions (read 13 October 2026) make the customer "solely responsible for any AI Content, including the accuracy, quality, appropriateness, and legality thereof". In the workflow, a named person owns each human…
How does Moxo keep humans in control when AI agents run a workflow?
Moxo keeps people on the decisions by design: approvals and other human steps are ones its product page says "only a person can close", and AI agents can fill preparer, advisor or reviewer slots around them (both read 15 September 2026). The checks on AI output are opt-in…