OpenParable
Skip to content
← Back to skills

Debug Agent

Agent Building
debug-agent

Debug Agent is an Agent Skill for agent building published in the majiayu000/claude-skill-registry repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Depurar o agente IA com metodologia

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/majiayu000/claude-skill-registry/blob/HEAD/skills/development/debug-agent/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/debug-agent, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Arquivos do Agente

  • backend/app/agent/agent.py - TaNaMaoAgent principal
  • backend/app/agent/orchestrator.py - Orquestrador de fluxo
  • backend/app/agent/tools/ - 25+ ferramentas MCP
  • backend/app/agent/subagents/ - Sub-agentes especializados

Debugging Sistematico (5 Passos)

1. REPRODUZIR: Isolar o problema

# Testar endpoint diretamente
curl -X POST "http://localhost:8000/api/v1/agent/v2/chat" \
  -H "Content-Type: application/json" \
  -d '{"message": "quero saber meus beneficios", "session_id": "debug-001"}'

2. LOCALIZAR: Identificar onde falha

# Verificar logs do FastAPI
docker compose logs -f backend

# Verificar Redis (sessoes)
redis-cli KEYS "session:*"
redis-cli GET "session:debug-001"

3. ISOLAR: Testar componentes individualmente

# Testar ferramenta especifica
from app.agent.tools.consulta_beneficios import consultar_cpf
resultado = await consultar_cpf("12345678901")
print(resultado)

4. CORRIGIR: Aplicar fix minimo

  • Fazer mudanca cirurgica
  • Nao refatorar codigo adjacente
  • Manter estilo existente

5. VERIFICAR: Confirmar correcao

# Re-testar cenario original
curl -X POST "http://localhost:8000/api/v1/agent/v2/chat" \
  -H "Content-Type: application/json" \
  -d '{"message": "quero saber meus beneficios", "session_id": "debug-002"}'

# Rodar testes relacionados
pytest backend/tests/test_agent.py -v

Checklist de Diagnostico

SintomaVerificarComando
500 ErrorLogs do backenddocker compose logs backend
TimeoutConexao com APIscurl -I https://api.example.com
Sessao perdidaRedisredis-cli PING
Tool nao executaPermissoes MCPVerificar .mcp.json
Resposta vaziaPrompt do agenteVerificar agent.py

Logs Estruturados

# Habilitar debug logging
export LOG_LEVEL=DEBUG
uvicorn app.main:app --reload

# Filtrar por modulo
docker compose logs backend 2>&1 | grep "agent"
docker compose logs backend 2>&1 | grep "ERROR"

Testar Ferramentas Isoladamente

# backend/scripts/test_tool.py
import asyncio
from app.agent.tools.consulta_cras import buscar_cras

async def main():
    resultado = await buscar_cras(lat=-23.5505, lng=-46.6333)
    print(resultado)

asyncio.run(main())