aws / aws/bedrock-agentcore-starter-toolkit
[BUG] Runtime error
- Dominant language
- Python
- Stars
- 508
- Forks
- 155
- Avg merge
- 8h 50m
- Merged PRs (30d)
- 4
Description
**Describe the bug**
When running Lab 4 of the AWS workshop Deploy to Production - Use AgentCore Runtime with Observability, I get the error RuntimeError: asyncio.run() cannot be called from a running event loop. This error only occurs with version bedrock-agentcore-starter-toolkit==0.1.15. It does not happen with the previous version.
**To Reproduce**
Steps to reproduce the behavior:
1. Install package bedrock-agentcore-starter-toolkit==0.1.15
2. Run the following code snippet from Lab 4:
```
from bedrock_agentcore_starter_toolkit import Runtime
from lab_helpers.utils import create_agentcore_runtime_execution_role
import boto3
boto_session = boto3.session.Session()
region = boto_session.region_name
execution_role_arn = create_agentcore_runtime_execution_role()
agentcore_runtime = Runtime()
response = agentcore_runtime.configure(
entrypoint="lab_helpers/lab4_runtime.py",
execution_role=execution_role_arn,
auto_create_ecr=True,
requirements_file="requirements.txt",
region=region,
agent_name="customer_support_agent",
authorizer_configuration={
"customJWTAuthorizer": {
"allowedClients": [cognito_config.get("client_id")],
"discoveryUrl": cognito_config.get("discovery_url"),
}
},
)
print("Configuration completed:", response)
```
**Expected behavior**
The configuration should complete successfully without raising a runtime error.
`RuntimeError: asyncio.run() cannot be called from a running event loop`
**Environment:**
- AWS Sagemaker Studio - jupyter lab
Libs:
- strands-agents
- strands-agents-tools
- boto3>=1.40.8
- botocore>=1.40.8
- bedrock-agentcore>=0.1.2
- bedrock-agentcore-starter-toolkit=>0.1.15
- aws-opentelemetry-distro
- ddgs
- aws-opentelemetry-distro~=0.10.1
- pyyaml
**Additional context**
This issue does not occur with version 0.1.14.
Contributor guide
Research direction
Reproduce Lab 4 in Jupyter with bedrock-agentcore-starter-toolkit 0.1.15, then compare it with 0.1.14 using the shown Runtime.configure call and lab_helpers/lab4_runtime.py entrypoint. Start by tracing Runtime.configure to the asyncio.run() call; done means configuration completes successfully without the running-event-loop error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, jupyter, python
- Domain
- cloud, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100