aws / aws/bedrock-agentcore-starter-toolkit

AgentCore Deployment Failure: ResourceNotFoundException Due to Stale Agent Configuration

Open
#289 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
508
Forks
155
Avg merge
8h 50m
Merged PRs (30d)
4

Description

## Summary
Agent deployment fails with `ResourceNotFoundException` when trying to update a non-existent agent ID that remains in the local configuration file after the agent was deleted from AgentCore.

## Environment
- **AgentCore SDK Version**: bedrock-agentcore-starter-toolkit==0.1.25
- **Platform**: macOS
- **Region**: us-east-1
- **Framework**: Strands Agents
- **Python**: 3.13
- **Deployment Method**: CodeBuild (cloud build)
- **Container Runtime**: ARM64

## Issue Description
When deploying an agent, the process fails during the "Deploying to Bedrock AgentCore..." step with:

```
launch_result = agentcore_runtime.launch()
✅ ECR repository available: .dkr.ecr.us-east-1.amazonaws.com/bedrock-agentcore-strands_claude_getting_started
Using execution role from config: arn:aws:iam:::role/role-agentcore
Preparing CodeBuild project and uploading source...
Using CodeBuild role from config: arn:aws:iam:::role/role-codebuild
Using .dockerignore with 44 patterns
Uploaded source to S3: strands_claude_getting_started/source.zip
Updated CodeBuild project: bedrock-agentcore-strands_claude_getting_started-builder
Starting CodeBuild build (this may take several minutes)...
Starting CodeBuild monitoring...
🔄 QUEUED started (total: 0s)
✅ QUEUED completed in 1.3s
🔄 PROVISIONING started (total: 2s)
✅ PROVISIONING completed in 9.3s
🔄 DOWNLOAD_SOURCE started (total: 11s)
✅ DOWNLOAD_SOURCE completed in 1.3s
🔄 BUILD started (total: 12s)
✅ BUILD completed in 17.2s
🔄 POST_BUILD started (total: 29s)
✅ POST_BUILD completed in 11.8s
🔄 COMPLETED started (total: 41s)
✅ COMPLETED completed in 1.3s
🎉 CodeBuild completed successfully in 0m 42s
CodeBuild completed successfully
✅ CodeBuild project configuration saved
Deploying to Bedrock AgentCore...
Failed to update agent ID 'strands_claude_getting_started-af637': An error occurred (ResourceNotFoundException) when calling the UpdateAgentRuntime operation: Agent 'strands_claude_getting_started-af637' was not found. Please check the agent ID and try again.
```

## Root Cause
The `.bedrock_agentcore.yaml` configuration file contains a stale `bedrock_agentcore` section with an agent ID that no longer exists in the AgentCore service. The deployment process attempts to **update** the existing agent instead of creating a new one.

## Steps to Reproduce
1. Deploy an agent successfully (creates agent ID in config)
2. Delete the agent from AgentCore (via console/API) OR agent gets deleted/corrupted
3. Attempt to redeploy the same agent using `agentcore_runtime.launch()`
4. CodeBuild completes successfully (container builds and pushes to ECR)
5. Deployment fails during "Deploying to Bedrock AgentCore..." step with "Agent not found" error

## Expected Behavior
- The SDK should detect that the agent ID no longer exists
- Automatically create a new agent instead of trying to update
- Update the configuration with the new agent ID

Contributor guide

Open the contributing guide

Research direction

Start at the agentcore_runtime.launch() deployment flow and inspect how the bedrock_agentcore section in .bedrock_agentcore.yaml selects update versus create. Trace the UpdateAgentRuntime failure for a missing agent ID, then verify that a redeploy creates a replacement agent and updates the configuration after the CodeBuild step succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, python
Domain
cloud, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.