- New ask_user core tool: mid-turn user question with option picking, refusing cleanly in autonomous mode, for background workers, and without a tty; system prompt points at it instead of prose questions. - Structural loop control for prompt-JSON CLI backends (opencode, grok, claude, codex, gemini): shared cli_json_turn repairs a missing JSON envelope exactly once, then accepts prose; prompt contract hardened against narrate-without-calling. - research/agentic-tool-loop-design: 74 sources plus 2 conclusions backing the loop-control decisions; INDEX updated to 6 subjects.
3.1 KiB
3.1 KiB
Building Agents with the Claude Agent SDK
Metadata
| Field | Value |
|---|---|
| Institute | Molodetz Institute — Research & Retrieval Division |
| Subject | agentic-tool-loop-design |
| Document type | Source Dossier |
| Tier | 1 |
| Source title | Building agents with the Claude Agent SDK |
| Source URL | https://claude.com/blog/building-agents-with-the-claude-agent-sdk |
| Source publisher / author | Anthropic (Claude blog) |
| Source type | blog post |
| Source date (published) | 2025-09-29 |
| Date researched | 2026-10-11 |
| Researched by | tai (agent), model: Muse Spark, on behalf of retoor |
| Research method | direct page fetch |
| Confidence | High |
| Status | Active |
Summary
Anthropic's SDK announcement post framing the Claude Code harness as a general agent loop: gather context, take action, verify work, repeat. It prescribes agentic file search over semantic search as the starting default, subagents for parallelization and context isolation, automatic compaction near context limits, bash/filesystem access as the core computer interface, and verification via rules-based feedback, visual checks, or LLM-as-judge.
Key findings
- The canonical agent feedback loop is stated as: gather context -> take action -> verify work -> repeat.
- Core design principle: give the agent a computer (terminal, file read/write/edit/search) so it works like a human; bash plus file tools cover most non-coding tasks too.
- Prefer agentic search (grep/tail over the filesystem) first; add semantic/vector search only if faster results or more variations are needed, since it is less accurate, harder to maintain, and less transparent.
- Subagents serve parallelization and context management: isolated context windows that return only relevant excerpts to the orchestrator.
- Compaction: automatically summarize previous messages as the context limit approaches so long-running agents do not run out of context.
- Verification makes agents reliable: rules-based feedback (linting, validators) is best, visual feedback for visual tasks, LLM-as-judge as a costly last resort.
- Debugging guidance: when the agent fails, check whether it has the right tools before blaming the model or prompt.
Pros / strengths
- Describes the production harness behind Claude Code, the closest industry reference to what tai is.
- Concrete ordering advice (agentic search before semantic search, rules before LLM-judge) with stated reasons.
Cons / limitations / caveats
- Product announcement, so SDK-framed; the loop itself is vendor-neutral but examples assume Claude models.
- No treatment of multi-backend fallback or weak-model reliability.
Relevance to tai
- Confirms tai's architecture is pointed the right way: shell/file tools as the computer interface, fork/poll subagents with isolated context, history compaction, and verify-by-execution all match this reference.
- The verify-work phase supports tai's convention of checking tool results before reporting, and argues against ending turns on ungrounded prose.
Changelog
| Date | Change |
|---|---|
| 2026-10-11 | Initial dossier created. |