aws / aws/bedrock-agentcore-starter-toolkit

[BUG] agentcore_runtime.launch() does not automatically fallback to a fresh create_agent sequence when the agent is missing or deleted.

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

Description

**Describe the bug**
agentcore_runtime.launch() API does not automatically fallback to a fresh create_agent sequence when the agent is missing or deleted.

Automatic idempotency with launch() does not cover deleted agents in Bedrock AgentCore Starter Toolkit; explicit agent recreation is necessary if the agent no longer exists.

**To Reproduce the behaviour **
1. run the sample notebook
https://github.com/awslabs/amazon-bedrock-agentcore-samples/blob/main/01-tutorials/01-AgentCore-runtime/01-hosting-agent/01-strands-with-bedrock-model/runtime_with_strands_and_bedrock_models.ipynb
2.delete agent runtime created from bedrock agent core console
3. rerun the jupyter notebook without changing the agent name
4. agent_core_runtime.launch fail, trying to update the previous agent runtime it can find as it is deleted

**Expected behavior**
agent_core_runtime.launch should graciously detect that the agent runtime is missing and instead of trying to update existing agent, should create a new agent

**Error Output**
```
CodeBuild completed successfully
✅ CodeBuild project configuration saved
Deploying to Bedrock AgentCore...
Failed to update agent ID 'strands_claude_getting_started_123-QMpwRTD7eK': An error occurred (ResourceNotFoundException) when calling the UpdateAgentRuntime operation: Agent 'strands_claude_getting_started_123-QMpwRTD7eK' was not found. Please check the agent ID and try again
---------------------------------------------------------------------------
ResourceNotFoundException Traceback (most recent call last)
Cell In[19], line 1
----> 1 launch_result = agentcore_runtime.launch(
File /opt/conda/lib/python3.12/site-packages/bedrock_agentcore_starter_toolkit/notebook/runtime/bedrock_agentcore.py:188, in Runtime.launch(self, local, local_build, auto_update_on_conflict, env_vars)
185 use_codebuild = not (local or local_build)
187 try:
--> 188 result = launch_bedrock_agentcore(
189 self._config_path,
190 local=local,
191 use_codebuild=use_codebuild,
192 auto_update_on_conflict=auto_update_on_conflict,
193 env_vars=env_vars,
194 )
195 except RuntimeError as e:
196 # Enhance Docker-related error messages
197 error_msg = str(e

```
**Environment:**
- OS: [Jupyter Notebook, Python 3 ipykernel]
- Python version: [3.12.9]
- Package version: [pip 25.1.1]
- Installation method: [pip install -r requirements.txt]

**Additional context**
requirements.txt :

strands-agents
strands-agents-tools
uv
boto3
bedrock-agentcore
bedrock-agentcore-starter-toolkit

Contributor guide

Open the contributing guide

Research direction

Start with Runtime.launch in bedrock_agentcore.py around the traceback at line 188, then trace the deployment path that attempts the agent runtime update. Reproduce the deletion and rerun using the linked runtime_with_strands_and_bedrock_models.ipynb; done means launch detects the missing runtime, creates a replacement, and completes successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, jupyter-notebook, python
Domain
api, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.