Agent skill
debug-agent
Depurar o agente IA com metodologia
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/debug-agent
SKILL.md
Arquivos do Agente
backend/app/agent/agent.py- TaNaMaoAgent principalbackend/app/agent/orchestrator.py- Orquestrador de fluxobackend/app/agent/tools/- 25+ ferramentas MCPbackend/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
| Sintoma | Verificar | Comando |
|---|---|---|
| 500 Error | Logs do backend | docker compose logs backend |
| Timeout | Conexao com APIs | curl -I https://api.example.com |
| Sessao perdida | Redis | redis-cli PING |
| Tool nao executa | Permissoes MCP | Verificar .mcp.json |
| Resposta vazia | Prompt do agente | Verificar 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())
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?