Skip to main content

Toolkit for Seamlessly Enabling RL Training with Bedrock AgentCore.

Project description

AgentCore RL Toolkit (ART)

Toolkit for Seamlessly Enabling RL Training on Any Agent with Bedrock AgentCore.

Repo Structure

  • Main package: agentcore-rl-toolkit is a thin wrapper around of bedrock-agentcore-sdk-python that allows developers to start RL training their production agent with only a few lines of code change.
  • Examples: Located in examples/ directory, each with their own pyproject.toml and dependencies. Their corresponding docker files are located in .bedrock_agentcore, most of which have been generated automatically (see instructions below).

Start Training on Example Agents

AgentCore runtime is currently supported by the following training library.

Before training, build the docker for the RL-ready application and upload to ECR. To do this, follow the steps below:

Setup Credentials and Environment Variables

First, make sure aws sts get-caller-identity returns the right identity. If not, follow the developer guide to set up AWS Credentials. After setup, run aws sts get-caller-identity again to verify.

Next, the build script requires info related to your AWS account. Create a .env file from the example:

cp .env.example .env

Then edit .env and fill in your values:

  • AWS_REGION: Your AWS region (e.g., us-west-2)
  • AWS_ACCOUNT: Your AWS account ID
  • ECR_REPO_NAME: Your ECR repository name

Build and Push Docker Image

# Use examples/strands_math_agent as an example
chmod +x scripts/build_docker_image_and_push_to_ecr.sh
bash ./scripts/build_docker_image_and_push_to_ecr.sh --dockerfile=.bedrock_agentcore/examples_strands_math_agent_rl_app/Dockerfile --tag=dev

Then, go to the training library of your choice and simply provide agentcore specific config args to start training.

Development

Installation

This project uses uv for dependency management. Install uv if you haven't already, follow the installation guide here.

For Package Development

If you're developing or contributing to the agentcore-rl-toolkit package itself:

# Enter the repository
cd agentcore-rl-toolkit

# Create and activate uv environment
uv venv --python 3.13
source .venv/bin/activate

# Install with development dependencies
uv sync --frozen --extra dev

# Install pre-commit hooks
pre-commit install

Additionally, when co-developing the toolkit together with examples, add the following to the example app's docker file so that changes to the toolkit is reflected in the container.

COPY . .
RUN uv pip install --force-reinstall --no-deps .

For Running Examples

Each example has its own dependencies and can be installed independently. Follow the README for specific examples there (e.g., examples/strands_math_agent/README.md).

Appendix

Prepare Docker file

Docker file for most examples can be automatically generated with the agentcore CLI. Use examples/strands_math_agent as an example:

agentcore configure --entrypoint examples/strands_math_agent/rl_app.py --requirements-file examples/strands_math_agent/pyproject.toml --deployment-type container --disable-memory --non-interactive

Make sure to run the command in project root.

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentcore_rl_toolkit-0.1.0.tar.gz (92.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agentcore_rl_toolkit-0.1.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file agentcore_rl_toolkit-0.1.0.tar.gz.

File metadata

  • Download URL: agentcore_rl_toolkit-0.1.0.tar.gz
  • Upload date:
  • Size: 92.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for agentcore_rl_toolkit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6ad0126ad293e4fa0c878d8154fba5c668d0c02f974c300b2760ec10f53b6a9e
MD5 7314ef5cac2b650182740aa0495dcee4
BLAKE2b-256 1dc27c2f9430848c45e4d54618bdf942ddd9d5acddaf11292ff8caff3f4af3ba

See more details on using hashes here.

File details

Details for the file agentcore_rl_toolkit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: agentcore_rl_toolkit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for agentcore_rl_toolkit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56376b5ef3f13db5922641e21f161ee7640ed8fb0849bf0d903c3e44eb3ec90c
MD5 0eddb87d9ca43182cd8131ca114f5714
BLAKE2b-256 b201a024d765fa440930460c18dfe2cde2ab54e09287ae97a8814cb002d8022c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page