debugging-agents

A troubleshooting guide for Agent2 agents, covering configuration, imports, Docker containers, authentication, knowledge search, and response formats. Agent2 agents are software agents that can run as services and answer API requests.

In plain words
What is it for?
Checking container health and logs, diagnosing API-key and token problems, fixing import or configuration issues, and investigating schema or knowledge-search failures.
Why use it?
It provides a systematic way to identify why an agent returns errors, fake data, empty searches, invalid responses, or fails to start.

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/artesiana/agent2/debugging-agents
Any agent
npx skills add Artesiana/agent2 --skill debugging-agents
Clone the repo
git clone --depth 1 https://github.com/Artesiana/agent2

Made for: Claude Code, Codex.

Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 883 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00045 $0.00883
Opus 5 $0.00023 $0.00441
Sonnet 5 $0.00009 $0.00177
Haiku 4.5 $0.00005 $0.00088

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

Security

Grade A, and why

debugging-agents scanned grade A with 1 finding 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 2d ago.

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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl http://localhost:<port>/health
.agents/skills/debugging-agents/SKILL.md · 88 lines

How it starts

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

Debugging Agents

Overview

Systematic diagnosis for Agent2 agent problems. Most issues are config, imports, or missing infrastructure — not code bugs.

When to Activate

  • Agent returns 500 errors or problem+json responses
  • Agent returns mock data when you expect real LLM output
  • Agent Docker container won't start or isn't healthy
  • Agent doesn't find knowledge collections
  • Agent output doesn't match expected schema
  • Tests pass but Docker agent fails

Diagnostic Flowchart

Agent not working?
  ├─ Returns mock data? → Check OPENROUTER_API_KEY (is it set? valid?)
  ├─ 500 error? → Check logs: docker compose logs <agent-name>
  ├─ Container unhealthy? → Check Dockerfile (config copy? PYTHONPATH?)
  ├─ 401/403? → Check API_BEARER_TOKEN matches between client and .env
  ├─ Knowledge search empty? → Is R2R running? (--profile full) Were docs ingested?
  ├─ Schema validation error? → Agent output doesn't match output_type. Check prompt.
  └─ Import error? → Check agent module structure (__init__.py, agent.py naming)

Quick Diagnosis Commands

# 1. Is the container running and healthy?
docker compose ps <agent-name>

# 2. What do the logs say?
docker compose logs <agent-name> --tail=50

# 3. Can you hit the health endpoint?
curl http://localhost:<port>/health

# 4. Does mock mode work? (tests framework without LLM)
curl -X POST http://localhost:<port>/tasks?mode=sync \
  -H "Authorization: Bearer dev-token-change-me" \
  -H "Content-Type: application/json" \
  -d '{"input":{"text":"test"}}'

# 5. Are tests passing?
uv run pytest tests/ -v --tb=short

# 6. Is the Docker Compose config valid?
docker compose config --quiet

Common Issues

Symptom Cause Fix
_mock_reason: provider_auth_failed OPENROUTER_API_KEY is invalid Get a fresh key from openrouter.ai/keys
Mock data returned, no error OPENROUTER_API_KEY is empty Set it in .env
Could not import agent module Import path wrong in Docker Check Dockerfile: COPY agents/<name>/ ./agent/ and PYTHONPATH=/app
config.yaml not found Config not copied in Dockerfile Add mkdir -p agents/<name> && cp agent/config.yaml agents/<name>/config.yaml
toolsets=None error Passing None instead of empty list Use toolsets=[] not toolsets=None
Knowledge search returns nothing R2R not running or docs not ingested docker compose --profile full up -d then python -m shared.ingest --all
ProblemError 422 Input shape wrong input must be a JSON object: {"input": {"text": "..."}}
Container exits immediately Python import error Run locally first: uv run python -c "from agents.<name>.agent import agent"
Schema validation retry loop Agent output doesn't fit Pydantic model Simplify schema, add clearer prompt instructions, check Field constraints

Read the full file on GitHub · 88 lines

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. 2d ago First seen · 88 lines · 45 tokens per session scan A c0e1524779ed

Subscribe to this mod's changes

debugging-agents is a skill published in the GitHub repository Artesiana/agent2 (36 stars, last pushed 3mo ago), licensed MIT. It adds 45 tokens to every session and 883 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

fastapi-modern-patterns

Curated Knowledge API for AI Agents — 68 MCP tools, 200+ skill packs, 46K chunks, semantic search over 670K vectors, 5-layer validation pipeline. Works with Claude Code, Cursor, Cline, Windsurf.

MidOSresearch/midos · 5 tokens

fastapi-microservices-development

Comprehensive guide for building production-ready microservices with FastAPI including REST API patterns, async operations, dependency injection, and deployment strategies.

manutej/luxor-claude-marketplace · 33 tokens

datamodel-code-generator

Use this skill when the user wants Python data models, Pydantic models, dataclasses, TypedDicts, msgspec structs, or type-safe Python classes generated from OpenAPI, AsyncAPI, JSON Schema, GraphQL, JSON/YAML/CSV sample data, MCP tool schemas, Protocol Buffers, XML Schema, Apache Avro, or existing Python model objects.…

koxudaxi/datamodel-code-generator · 147 tokens

openai-docs

Use when the user asks how to build with OpenAI products or APIs and needs up-to-date official documentation with citations (for example: Codex, Responses API, Chat Completions, Apps SDK, Agents SDK, Realtime, model capabilities or limits); prioritize OpenAI docs MCP tools and restrict any fallback browsing to…

Soju06/codex-lb · 74 tokens

training-llms-megatron

Trains large language models (2B-462B parameters) using NVIDIA Megatron-Core with advanced parallelism strategies. Use when training models >1B parameters, need maximum GPU efficiency (47% MFU on H100), or require tensor/pipeline/sequence/context/expert parallelism. Production-ready framework used for Nemotron, LLaMA…

Orchestra-Research/AI-Research-SKILLs · 82 tokens

environment-discovery

Systematic exploration of unknown environments before starting work.

vstorm-co/pydantic-deepagents · 13 tokens