aws/agent-toolkit-for-aws/agents-debug
Claude Code and agent skill by aws/agent-toolkit-for-aws
- community
Checking that the SKILL.md file is still in the repository.
Use when your agent or environment is broken — wrong answers, errors, timeouts, tool failures, or CLI issues. Reads traces and logs to diagnose root causes. Also checks prerequisites when the CLI itself isn't working. Triggers on: "agent not working", "wrong answer", "agent error", "tool call failing", "debug agent", "check logs", "read traces", "broken", "500 error", "424 error", "model access denied", "command not found", "stuck in DELETING", "maxVms exceeded", "cold start diagnosis", "cold start slow", "agentcore create error", "create failed", "exit code 7", "connection refused local dev". Not for deploy failures — use agents-deploy. Not for performance tuning without errors — use agents-optimize. Not for VPC configuration — use agents-build. Not for observability setup or missing logs — use agents-optimize.
Install
npx vskill@latest install aws/agent-toolkit-for-aws/agents-debugSKILL.md
The same SKILL.md was published earlier as aws/agent-toolkit-for-aws/agents-debug.
debug
Diagnose why your AgentCore agent or environment isn't working correctly.
When to use
- Your agent is returning wrong answers or errors
- Tool calls are failing or timing out
- Agent works locally but fails after deploying
- Logs aren't showing up in CloudWatch
- The AgentCore CLI isn't working or environment seems broken
agentcorecommand not found or prerequisites are missing
Do NOT use for:
- Deploy failures (CDK errors, IAM during deploy) → use
agents-deploy - Scaffolding a new project → use
agents-get-started - Measuring quality or setting up monitoring → use
agents-optimize
Input
$ARGUMENTS is optional:
Process
Step 0: Determine problem type
If the developer's issue is about the CLI itself (command not found, prerequisites, environment setup), load `references/doctor.md` and follow its diagnostic checklist.
If the issue is about agent behavior (wrong answers, errors, timeouts, tool failures), continue with Step 1 below.
Step 1: Verify CLI version
Run agentcore --version. This skill requires v0.9.0 or later. If the version is older, tell the developer to run agentcore update before proceeding.
Step 2: Understand the symptom
Ask (or infer from context):
"What's happening?1. The agent returns an error message2. The agent returns a wrong or unhelpful answer3. A specific tool call is failing4. Memory isn't working (agent doesn't remember things)5. The agent is slow or timing out6. I want to understand what the agent did in a specific session"
Step 3: Read traces and logs automatically
Don't ask the developer to paste logs — read them directly.
Important: CloudWatch put-to-get latency is ~10 seconds end-to-end — that's the delay from when a span is emitted to when it's readable by agentcore traces get or agentcore run eval. There is no separate "trace ingested but eval not ready yet" window; the same ingestion step unlocks both paths. Older skills and docs said 30–60s for traces and 2–5 minutes for evals — both are stale. If you just invoked the agent, wait ~15 seconds and both trace reads and evals will work.
Read agentcore/agentcore.json to get the agent name if not provided.
Step 4: Diagnose by symptom
Symptom: "model access denied" or model error
Most common cause: The model isn't enabled in the Bedrock console for your region.
Fix:
- Go to AWS Console → Amazon Bedrock → Model access
- Enable the model your agent uses
- Wait 1–2 minutes for access to propagate
Second cause: The execution role is missing bedrock:InvokeModel.
Check:
Third cause: Cross-region inference profile requires model access in all regions.
Model IDs starting with a geographic prefix are cross-region inference profiles that route requests within that geography:
| Prefix | Geography | Example destination regions | |
|---|---|---|---|
us. | United States | us-east-1, us-east-2, us-west-2 | |
eu. | Europe | eu-central-1, eu-west-1, eu-west-2, eu-west-3 | |
apac. | Asia Pacific | ap-northeast-1, ap-southeast-1, ap-southeast-2, ap-south-1 | |
global. | All commercial regions worldwide | All supported regions |
The AgentCore CLI scaffolds global. by default (e.g., global.anthropic.claude-sonnet-4-5-20250929-v1:0). All prefixes require model access enabled in every destination region the profile covers. For us. profiles, enable in all US regions; for eu., all EU regions; for global., all supported regions. Not all models support all prefixes — global. is currently available for select models only. Use global. for maximum throughput when available, or a geographic prefix when data residency requirements constrain where inference can run. Check the Bedrock inference profiles docs for current model × prefix availability.
Symptom: Tool call failing
Step 1: Find the failing tool call in the trace:
Look for tool call entries with error status.
Step 2: Check the gateway status:
Step 3: Common tool call failures:
Gateway URL not set (local dev): The AGENTCORE_GATEWAY_*_URL env var is only set after deploy. In agentcore dev, gateway tools aren't available. This is expected — the agent should handle this gracefully.
Auth failure on tool call:
Check that the credential is configured correctly: agentcore status --type credential
Lambda function error: The Lambda itself is failing. Check Lambda logs directly:
Policy denial: If a policy engine is attached, check policy decision logs:
Symptom: Wrong or unhelpful answers
Step 1: Read the trace to see the agent's reasoning:
The trace shows the model's reasoning steps, tool calls made, and the final response. Look for:
- Did the agent use the right tools?
- Did the tool calls return the expected data?
- Is the system prompt providing the right context?
Step 2: Check if memory is involved: If the agent should be using memory context but isn't, see the "Symptom: Memory not persisting" section later in this skill, or load `references/doctor.md` if this is an environment issue.
Step 3: Common causes:
- System prompt is too vague or missing key context
- Agent isn't calling the right tools (tool descriptions need improvement)
- Tool is returning unexpected data format
- Model ID is wrong for the task (e.g., using a smaller model for complex reasoning)
Symptom: Memory not working
Memory not persisting across sessions (LTM):
- Verify LTM strategies are configured (SEMANTIC or USER_PREFERENCE):
- Wait 5–30 seconds after a session ends — LTM extraction is async. The agent must finish its session before facts are extracted.
- Use UUIDs (v4) for session IDs — the platform requires a minimum of 33 characters. Short IDs like "session-1" cause LTM to fail silently.
agentcore invokegenerates compliant IDs by default.
- Verify the memory resource is ACTIVE:
Memory not loading at session start:
- Check the
MEMORY_*_IDenv var is set:
- Verify the
actor_idis consistent across sessions — memory is scoped per actor.
- Check the namespace paths in your retrieval config match the namespaces used when writing.
Symptom: Agent timeout
Step 1: Check the trace for where time is being spent:
Look for long-running steps — model calls, tool calls, memory operations.
Step 2: Common timeout causes:
Slow agent initialization: If the first invocation after an idle period is slow but subsequent requests are fast, the agent is spending too much time initializing. Check for heavy imports at module level, database connections in global scope, or MCP client initialization during startup. Move expensive setup into the request handler or use lazy initialization. See the agents-harden skill for optimization guidance.
Model call timeout: The model is taking too long. Consider using a faster model for time-sensitive operations (e.g., Haiku instead of Sonnet for simple tasks).
Tool call timeout: The Lambda or external API is slow. Check the tool's own logs.
Memory retrieval timeout: Semantic search can be slow for large memory stores. Consider reducing top_k in your retrieval config.
VPC connectivity issue: If the agent is in a VPC, check security group rules and route tables. See agents-build (loads `references/vpc.md`) for VPC-specific debugging.
Symptom: ServiceQuotaExceededException: maxVms limit exceeded (despite low observed concurrency)
Your CloudWatch "concurrent sessions" metric shows modest numbers (maybe 30–50) but InvokeAgentRuntime calls return ServiceQuotaExceededException: maxVms limit exceeded.
What's actually happening: CloudWatch's concurrent-sessions metric is not the same as live microVM count. The maxVms quota counts all environments your account has active — including ones that finished their invocation but haven't been reclaimed yet. Idle-but-not-yet-reclaimed environments count against the quota until idleRuntimeSessionTimeout expires (default 900 seconds / 15 minutes) or you explicitly stop them.
If your code uses a new session ID per request and doesn't call StopRuntimeSession, every request leaves an environment sitting idle for 15 minutes counting against the quota.
Fix order (try in this order before requesting a quota increase):
- Call `StopRuntimeSession` after each logical request completes. If you're not going to send more requests on this session, stop it explicitly.
``python client.stop_runtime_session( agentRuntimeArn=runtime_arn, runtimeSessionId=session_id, ) ``
- Reuse session IDs across related requests. If a user interaction produces multiple backend calls, route them to the same session instead of generating a new session ID per call.
- Lower `idleRuntimeSessionTimeout`. If your sessions are short-lived and you can't add
StopRuntimeSessioneverywhere, lower the timeout by editing the runtime'slifecycleConfigurationinagentcore/agentcore.jsonand runningagentcore deploy.
- Only after the above, request a quota increase. See
agents-harden(loads `references/limits.md`) — request it through the Service Quotas console (Amazon Bedrock AgentCore), not by filing a support ticket directly.
See agents-harden Session lifecycle management section for the full pattern.
Symptom: 424 Failed Dependency on invoke
This usually means the agent container failed to start or crashed during initialization.
Step 1: Check the agent logs for startup errors:
Step 2: Common causes:
Missing Python dependency: The agent code imports a package not in pyproject.toml. The container starts but crashes on first request. Fix: add the dependency and redeploy.
Entrypoint crash: The main.py throws an exception during import or app.run(). Check logs for the traceback.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingplugins/aws-agents/skills/agents-debug/SKILL.md
Popularity
- Repository stars
- 2,206
- Repository forks
- 214
- 7-day trend score
- 38
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/aws/agent-toolkit-for-aws/agents-debug)