agentic-loops

agentic-loops is a skill for Claude Code, Codex from andr-ca/agentharness. It costs 36 tokens per session (1,966 once invoked), scanned A, original, MIT.

A guide to building software agents that repeatedly decide what to do, call tools, read the results, and continue until a task is complete. It covers multi-turn conversations, tool use, branching, and reflection.

In plain words
What is it for?
Use it when building tool-calling assistants, multi-step autonomous workflows, agent orchestration, or systems that need to inspect results and act again.
Why use it?
It helps avoid common agent failures such as malformed tool calls, lost tool-result context, missing argument checks, or endless loops.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/andr-ca/agentharness/agentic-loops
Any agent
npx skills add andr-ca/agentharness --skill agentic-loops
Clone the repo
git clone --depth 1 https://github.com/andr-ca/agentharness

Made for: Claude Code, Codex.

Per session 36 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,966 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00036 $0.01966
Opus 5 $0.00018 $0.00983
Sonnet 5 $0.00007 $0.00393
Haiku 4.5 $0.00004 $0.00197

Measured 3d ago against content hash 541b57987bcb, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

agentic-loops scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (agent_loop.py, test_agent_loop.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/skills/agentic-loops/SKILL.md · 266 lines

How it starts

The opening of the file, as written. The whole thing — 266 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agentic Loops: Agents, Tools, Workflows

Structured patterns for building multi-turn agents that reason, act, and observe.

An agentic loop is:

  1. Think: Agent reasons about task → decides action
  2. Act: Call tools / take action
  3. Observe: Get result, update state
  4. Repeat: Loop until task complete

Minimal Loop — use the tested implementation, don't hand-roll this

Don't write a bespoke think/act/observe loop from scratch — it's easy to get the tool-result protocol wrong (feeding a tool's result back as a plain "user" message loses the call binding and looks like human input to the model, instead of {"role": "tool", "tool_call_id": ..., ...}), easy to leave out a budget (infinite loop if the model never stops calling tools), and easy to skip argument validation (a malformed tool call reaches your tool function instead of being rejected).

agent_loop.py, bundled alongside this file (a symlink back to patterns/agentic-loops/agent_loop.py, so it resolves whether you installed the whole harness or only this one skill), is a minimal, tested (100% coverage), provider-neutral implementation that gets these right: JSON-Schema-validated arguments, provider-correct tool-result messages, an iteration + wall-clock budget, an optional approval hook, and an auditable trace that never logs raw tool output. See patterns/agentic-loops/README.md in the full harness checkout for the complete usage example and what it does not cover (sandboxing, prompt-injection handling, real cost accounting, cancellation, retries/idempotency, persistence, evals) — that guide isn't bundled with this skill since it's documentation, not something the skill needs to function.

# Run from this skill's own directory, or add it to sys.path — see
# test_agent_loop.py (also bundled here) for a runnable example.
from agent_loop import Budget, ToolSpec, run_agent_loop

tool = ToolSpec(name="add", fn=add, parameters_schema={...})  # JSON Schema
result = run_agent_loop(
    model_fn=my_provider_adapter,  # translates to/from your provider's native shape
    tools={"add": tool},
    messages=[{"role": "user", "content": "What is 2 + 3?"}],
    budget=Budget(max_iterations=5, max_seconds=30),
)

Read the full file on GitHub · 266 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 266 lines · 36 tokens per session scan A 541b57987bcb

Subscribe to this mod's changes

agentic-loops is a skill published in the GitHub repository andr-ca/agentharness (1 stars, last pushed 3d ago), licensed MIT. It adds 36 tokens to every session and 1,966 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

deepstream-sop

Use this skill when building, deploying, evaluating, debugging, or measuring latency for the DeepStream SOP Inference Microservice — a GPU-accelerated FastAPI service that detects whether operators perform assembly-line steps in order via event boundary detection (GEBD) plus VLM classification. Trigger even if the…

NVIDIA/skills · 219 tokens

cupynumeric-migration-readiness

Pre-migration readiness assessor for porting NumPy to cuPyNumeric. Use BEFORE substantial porting work begins when the user asks whether code will scale on GPU, whether they should migrate to cuPyNumeric, which NumPy patterns transfer cleanly, what must be refactored before porting, or mentions pre-port assessment…

NVIDIA/skills · 173 tokens

cuopt-install

Install cuOpt for Python, C, or server via pip, conda, or Docker; verify the install. For building cuOpt from source, see cuopt-developer.

NVIDIA/skills · 40 tokens

doca-common

Use this skill whenever the user is doing hands-on DOCA programming on a BlueField DPU or ConnectX NIC and needs the foundation primitives every per-library context rests on — walking the docactx lifecycle, discovering docadev / docadevinfo and gating on docacap before trusting a feature, wiring docammap /…

NVIDIA/skills · 242 tokens

doca-dma

Use this skill when the user is doing hands-on DOCA DMA programming — bringing up a docadma context, configuring the single docadmataskmemcpy task type, sizing buffers via the docadmacaptaskmemcpy queries, setting LOCALREADONLY / LOCALREADWRITE permissions on source / destination docammap regions (plus docammapexport…

NVIDIA/skills · 232 tokens

git-ai-search

Search and restore AI conversation context from git history.

git-ai-project/git-ai · 13 tokens