Skip to content

Commit 2eaa691

Browse files
authored
Updates to AWS AgentCore README and scripts (#1208)
Closes ## By Submitting this PR I confirm: - I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/NeMo-Agent-Toolkit/blob/develop/docs/source/resources/contributing.md). - We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license. - Any contribution which contains commits that are not Signed-Off will not be accepted. - When the PR is ready for review, new or existing tests cover these changes. - When the PR is ready for review, the documentation is up to date with these changes. ## Summary by CodeRabbit * **Documentation** * Updated title/branding, reordered steps, expanded prerequisites, and replaced direct-key instructions with a Secrets Manager–based credential workflow and runtime ID guidance. * **New Features** * Added helper scripts and run variants (with and without OpenTelemetry) to discover, run, update, and test runtimes; credentials loaded from Secrets Manager. * **Improvements** * Switched to environment-driven, dynamic container/runtime URIs, exported runtime identifiers for downstream use, Docker build optimizations, and IAM guidance for secrets access. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> Authors: - RanjitR (https://github.com/ronjer30) - Bryan Bednarski (https://github.com/bbednarski9) Approvers: - Bryan Bednarski (https://github.com/bbednarski9) URL: #1208
1 parent b09ec8f commit 2eaa691

File tree

9 files changed

+489
-273
lines changed

9 files changed

+489
-273
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
.git
2+
.github
3+
.venv
4+
__pycache__
5+
*.pyc
6+
*.pyo
7+
*.pyd
8+
.pytest_cache
9+
.mypy_cache
10+
.coverage
11+
*.egg-info
12+
dist
13+
build
14+
.tmp
15+
*.md
16+
docs
17+
tests
18+
.vscode
19+
.idea
20+
*.log

examples/frameworks/strands_demo/bedrock_agentcore/Dockerfile

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,18 @@ ENV PYTHONDONTWRITEBYTECODE=1
3030

3131
# Install compiler [g++, gcc] (currently only needed for thinc indirect dependency)
3232
RUN apt-get update && \
33-
apt-get install -y g++ gcc
33+
apt-get install -y --no-install-recommends g++ gcc curl unzip jq ca-certificates && \
34+
rm -rf /var/lib/apt/lists/*
35+
36+
37+
# Install AWS CLI v2
38+
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip" -o "awscliv2.zip" && \
39+
unzip awscliv2.zip && \
40+
./aws/install && \
41+
rm -rf awscliv2.zip aws
42+
43+
# Verify installation
44+
CMD ["aws", "--version"]
3445

3546
# Set working directory
3647
WORKDIR /workspace
@@ -49,7 +60,13 @@ RUN --mount=type=cache,id=uv_cache,target=/root/.cache/uv,sharing=locked \
4960
uv venv --python ${PYTHON_VERSION} /workspace/.venv && \
5061
uv sync --link-mode=copy --compile-bytecode --python ${PYTHON_VERSION} && \
5162
uv pip install -e '.[telemetry]' --link-mode=copy --compile-bytecode --python ${PYTHON_VERSION} && \
52-
uv pip install --link-mode=copy ./examples/frameworks/strands_demo
63+
uv pip install --link-mode=copy ./examples/frameworks/strands_demo && \
64+
uv pip install boto3 aws-opentelemetry-distro && \
65+
find /workspace/.venv -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true && \
66+
find /workspace/.venv -type f -name "*.pyc" -delete && \
67+
find /workspace/.venv -type f -name "*.pyo" -delete && \
68+
find /workspace/.venv -name "*.dist-info" -type d -exec rm -rf {}/RECORD {} + 2>/dev/null || true && \
69+
rm -rf /workspace/.venv/lib/python*/site-packages/pip /workspace/.venv/lib/python*/site-packages/setuptools
5370

5471
# AWS OpenTelemetry Distribution
5572
ENV OTEL_PYTHON_DISTRO=aws_distro
@@ -65,22 +82,31 @@ ENV AGENT_OBSERVABILITY_ENABLED=true
6582
# Service Identification attributed (gets added to all span logs)
6683
# Example:
6784
# OTEL_RESOURCE_ATTRIBUTES=service.version=1.0,service.name=mcp-calculator,aws.log.group.names=mcp/mcp-calculator-logs
68-
ENV OTEL_RESOURCE_ATTRIBUTES=service.name=nat_test_agent,aws.log.group.names=/aws/bedrock-agentcore/runtimes/<AGENTCORE_RUNTIME_ID>
85+
#ENV OTEL_RESOURCE_ATTRIBUTES=service.name=nat_test_agent,aws.log.group.names=/aws/bedrock-agentcore/runtimes/<AGENTCORE_RUNTIME_ID>
86+
ENV OTEL_RESOURCE_ATTRIBUTES=service.name=nat_test_agent,aws.log.group.names=/aws/bedrock-agentcore/runtimes/strands_test_demo-oNUmOg6xk0
6987

7088
# CloudWatch Integration (ensure the log group and log stream are pre-created and exists)
7189
# Example:
7290
# OTEL_EXPORTER_OTLP_LOGS_HEADERS=x-aws-log-group=mcp/mcp-calculator-logs,x-aws-log-stream=default,x-aws-metric-namespace=mcp-calculator
73-
ENV OTEL_EXPORTER_OTLP_LOGS_HEADERS=x-aws-log-group=/aws/bedrock-agentcore/runtimes/<AGENTCORE_RUNTIME_ID>,x-aws-log-stream=otel-rt-logs,x-aws-metric-namespace=strands_demo
74-
75-
RUN uv pip install boto3
76-
RUN uv pip install aws-opentelemetry-distro
91+
#ENV OTEL_EXPORTER_OTLP_LOGS_HEADERS=x-aws-log-group=/aws/bedrock-agentcore/runtimes/<AGENTCORE_RUNTIME_ID>,x-aws-log-stream=otel-rt-logs,x-aws-metric-namespace=strands_demo
92+
ENV OTEL_EXPORTER_OTLP_LOGS_HEADERS=x-aws-log-group=/aws/bedrock-agentcore/runtimes/strands_test_demo-oNUmOg6xk0,x-aws-log-stream=otel-rt-logs,x-aws-metric-namespace=strands_demo
93+
94+
# Remove build dependencies and cleanup (keep ca-certificates, curl, jq, unzip)
95+
RUN apt-mark manual ca-certificates curl jq unzip && \
96+
apt-get purge -y --auto-remove g++ gcc && \
97+
rm -rf /var/lib/apt/lists/* && \
98+
rm -rf /workspace/.git /workspace/.github /workspace/tests /workspace/docs && \
99+
find /workspace -type f -name "*.md" -not -path "*/site-packages/*" -delete && \
100+
find /workspace -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true && \
101+
find /workspace -type d -name ".mypy_cache" -exec rm -rf {} + 2>/dev/null || true
77102

78103
# Environment variables for the venv
79104
ENV PATH="/workspace/.venv/bin:$PATH"
105+
ENV REGION="us-west-2"
80106

81107
# Set the config file environment variable
82108
ENV NAT_CONFIG_FILE=/workspace/examples/frameworks/strands_demo/configs/agentcore_config.yml
83109

84110
# Define the entry point to start the server
85-
ENTRYPOINT ["sh", "-c", "exec nat serve --config_file=$NAT_CONFIG_FILE --host 0.0.0.0"]
111+
ENTRYPOINT ["sh", "-c", "exec /workspace/examples/frameworks/strands_demo/bedrock_agentcore/scripts/run_nat_with_OTEL.sh"]
86112
#ENTRYPOINT ["sh", "-c", "exec opentelemetry-instrument nat serve --config_file=$NAT_CONFIG_FILE --host 0.0.0.0"]

0 commit comments

Comments
 (0)