Consistent packaging between dev and deploy
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 18/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- aws, python
- Lĩnh vực
- build-system, cli
Hướng nghiên cứu
The problem sits in how agentcore deploy packages app/AgentA/* into /var/task, so start with the packaging step in the CLI source and compare it with the agentcore dev path that sets PYTHONPATH. The issue's example layout is app/AgentA/main.py with app/AgentA/model.py, plus a pytest.ini pythonpath=app setting. Done means the maintainers have agreed whether the package folder is preserved or the docs are changed, and a reproduction shows which import pattern works in all three contexts.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
Agentcore requires agent sources to be in separate app subfolders e.g. app/AgentA/main.py and app/AgentB/main.py.
If main.py needs to use model.py, its package imports must support all the following contexts:
- pytest (local and CICD)
- agentcore dev (local)
- agentcore runtime (in AWS)
Unfortunately there doesn't appear to be a package import approach that works in all contexts, mainly because agentcore deploy flattens app/AgentA/* into /var/task which breaks the package structure above main.py at runtime.
Fully qualified imports from AgentA.model import init work for pytest (by setting pythonpath=app in pytest.ini) and for agentcore dev by setting PYTHONPATH=$(pwd)/app. However it breaks at runtime because app/AgentA/model.py becomes var/task/model.py ... why on earth would agentcore deploy drop the AgentA parent folder?! Without being able to use fully qualified names (which are known to solve all manner of other import problems including pytest) we are restricted to only sibling imports or relative imports, neither of which address all three contexts above.
Sibling imports from model import init works in both agentcore dev and agentcore runtime. However it doesn't work for pytest with more than one agent in the repo e.g. app/AgentA/ and app/AgentB/ because the AgentA and AgentB package names can't be used. Are we being forced to resort to sys.path manipulations in test files, which is heavily discouraged?
Relative imports from .model import init works in pytest but doesn't work in agentcore dev or agentcore runtime due to an 'attempted relative import with no known package' error. Without the ability to configure the launch options, relative imports are entirely useless in agentcore (relative imports are also heavily discouraged).
Even if I move app/AgentA/main.py's imports into a subfolder app/AgentA/helper/model.py it still doesn't work, because pytest and agentcore dev need the AgentA package qualifier which breaks agentcore runtime.
In the last instance I'm forced to write my own import handling code in every source file, which is also heavilty discouraged.
To in summary, to correctly support all three contexts in repos containing multiple agents, at a minimum agentcore dev and agentcore runtime should be consistent in how they package files (duh). Additionally, agentcore deploy should retain the package structure inside app/ to support fully qualified imports. Alternatively, at the very least I should be able to configure launch options (in both dev and runtime) to allow package imports so that relative imports work, as ugly and undesirable as they may be.
Acceptance Criteria
Fully Qualified Imports Work Across All Three Contexts
- Given an agent with code
from AgentA.model import initinapp/AgentA/main.py - When running with
pytest(usingpythonpath=appin pytest.ini) - And when running with
agentcore dev - And when running in
agentcore runtime(AWS Lambda) - Then all three contexts resolve the import successfully without errors
Package Structure Preserved in Deployment
- Given an agent directory structure
app/AgentA/main.pyandapp/AgentA/model.py - When
agentcore deploypackages the agent - Then the deployed artifact in AWS Lambda retains the
AgentA/folder structure - And fully qualified imports continue to work at runtime (not flattened to
/var/task/model.py)
Consistent Execution Environment
- When an agent runs via
agentcore dev(local) - And the same agent runs via
agentcore runtime(AWS) - Then the
PYTHONPATHand package resolution behavior is identical - And no environment-specific sys.path workarounds are required
No Discouraged Patterns Required
- When developing an agent that supports pytest, agentcore dev, and agentcore runtime
- Then the code should use only recommended import patterns (fully qualified imports)
- And should not require sys.path manipulations, relative imports, or custom import handling code
Clear Documentation
- Given a developer new to the project
- When they read the documentation
- Then they have a single, clear pattern to follow for imports
- And the pattern works consistently across all three execution contexts
Additional Context
No response
- Ngôn ngữ chính
- TypeScript
- Star
- 339
- Fork
- 129
- Merge trung bình
- 19 giờ 21 phút
- Pull request đã merge (30 ngày)
- 125
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aws/agentcore-cli
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
aws/agentcore-cli#2940 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
aws/agentcore-cli#2939 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
aws/agentcore-cli#2938 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
invoke: CUSTOM_JWT runtime errors discard the response body and error type (e.g. "Token has expired")Có thể đã có người làm @n1dhruv đã nhận 6 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
aws/agentcore-cli#2875 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
--debug has no effect; service error name, HTTP status and request ID never reach the terminalCó thể đã có người làm @abhiramshaji-cyber đã nhận 3 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
aws/agentcore-cli#2874 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của aws/agentcore-cli
Issue tương tự
-
triage
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 64/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
ranxianglei/billion-context#7860 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
agent-oc-find-bugs api complexity → simple payment-methods recurring contributions reviewed stripe
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
opencollective/opencollective#9177 ·