aws / aws/bedrock-agentcore-starter-toolkit

[BUG] agentcore dev throws an error when using relative path in .bedrock_agentcore.yaml#entrypoint

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

Description

**Describe the bug**
When using relative path in .bedrock_agentcore.yaml, agentcore dev fails to resolve the correct module path.

Dev server throws this error:

```ERROR: Error loading ASGI app. Attribute "app" not found in module "strands_agent".```

**To Reproduce**
Steps to reproduce the behavior:

1. Use a relative path for the entrypoint:

`myagent_strands:
name: myagent_strands
entrypoint: src/strands_agent/agent.py
deployment_type: direct_code_deploy
runtime_type: PYTHON_3_12`

2. Run `agentcore dev`
3. Dev server throws this error:

```ERROR: Error loading ASGI app. Attribute "app" not found in module "strands_agent".```

**Expected behavior**
Dev server to run properly. Module to be resolved as src.strands_agent.agent:app

**Error Output**
```$ agentcore dev
🚀 Starting development server with hot reloading
Agent: myagent_strands
Module: strands_agent:app
💡 Test your agent with: agentcore invoke --dev "Hello" in a new terminal window
ℹ️ This terminal window will be used to run the dev server
Press Ctrl+C to stop the server

Server will be available at:
• Localhost: http://localhost:8080/invocations
• 127.0.0.1: http://127.0.0.1:8080/invocations
• Local network: http://192.168.178.27:8080/invocations

INFO: Will watch for changes in these directories: ['/Users/myuser/Documents/myagent']
INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit)
INFO: Started reloader process [85614] using StatReload
ERROR: Error loading ASGI app. Attribute "app" not found in module "strands_agent".
```
**Environment:**
- OS: macOS
- Python version: 3.10.3
- Package version: 0.1.0
- Installation method: pip

**Additional context**
What worked for me is to change https://github.com/aws/bedrock-agentcore-starter-toolkit/blob/11855b7a252d52d0d2ca9c716db04837c8f1a885/src/bedrock_agentcore_starter_toolkit/cli/runtime/dev_command.py#L154 to

```entrypoint_path = Path(agent_config.entrypoint.strip()).absolute()```

Contributor guide

Open the contributing guide

Research direction

Start in src/bedrock_agentcore_starter_toolkit/cli/runtime/dev_command.py around line 154 and reproduce the issue with the relative entrypoint shown in the report. Verify that agentcore dev resolves it as src.strands_agent.agent:app and starts the development server without the ASGI attribute error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.