agentleFS
ArtesianaArtesiana/agent2/.github/skills/debugging-agents/SKILL.md

debugging-agents

Skill36 starsChanged 7 months agoMITView on GitHub

Use when an Agent2 agent returns errors, 500s, mock data unexpectedly, fails to start, or behaves incorrectly — systematic diagnosis for framework issues, config problems, Docker issues, and runtime failures

  • Reads credentials
  • Sends data out

The file

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always verify locally first, then Docker.

    line 87

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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

SymptomCauseFix
_mock_reason: provider_auth_failedOPENROUTER_API_KEY is invalidGet a fresh key from openrouter.ai/keys
Mock data returned, no errorOPENROUTER_API_KEY is emptySet it in .env
Could not import agent moduleImport path wrong in DockerCheck Dockerfile: COPY agents/<name>/ ./agent/ and PYTHONPATH=/app
config.yaml not foundConfig not copied in DockerfileAdd mkdir -p agents/<name> && cp agent/config.yaml agents/<name>/config.yaml
toolsets=None errorPassing None instead of empty listUse toolsets=[] not toolsets=None
Knowledge search returns nothingR2R not running or docs not ingesteddocker compose --profile full up -d then python -m shared.ingest --all
ProblemError 422Input shape wronginput must be a JSON object: {"input": {"text": "..."}}
Container exits immediatelyPython import errorRun locally first: uv run python -c "from agents.<name>.agent import agent"
Schema validation retry loopAgent output doesn't fit Pydantic modelSimplify schema, add clearer prompt instructions, check Field constraints

Debugging Locally vs Docker

Local (faster iteration):

uv run uvicorn agents.<name>.main:app --port 8000

Docker (production-like):

docker compose build <name>
docker compose up <name> redis -d
docker compose logs <name> -f

Always verify locally first, then Docker. Most Docker issues are path/copy problems, not code.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.