akeyless-agentcore-runtime 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- akeyless_agentcore_runtime-0.2.0/.env.example +17 -0
- akeyless_agentcore_runtime-0.2.0/.github/workflows/ci.yml +23 -0
- akeyless_agentcore_runtime-0.2.0/.github/workflows/publish.yml +23 -0
- akeyless_agentcore_runtime-0.2.0/.gitignore +31 -0
- akeyless_agentcore_runtime-0.2.0/CONTRIBUTING.md +48 -0
- akeyless_agentcore_runtime-0.2.0/LICENSE +19 -0
- akeyless_agentcore_runtime-0.2.0/PKG-INFO +257 -0
- akeyless_agentcore_runtime-0.2.0/README.md +221 -0
- akeyless_agentcore_runtime-0.2.0/SECURITY.md +21 -0
- akeyless_agentcore_runtime-0.2.0/docs/AKEYLESS_SETUP.md +134 -0
- akeyless_agentcore_runtime-0.2.0/docs/DEPLOYMENT.md +141 -0
- akeyless_agentcore_runtime-0.2.0/docs/INSTALL.md +116 -0
- akeyless_agentcore_runtime-0.2.0/examples/README.md +26 -0
- akeyless_agentcore_runtime-0.2.0/examples/gateway-lambda/handler.py +11 -0
- akeyless_agentcore_runtime-0.2.0/examples/gateway-lambda/setup_gateway_target.py +60 -0
- akeyless_agentcore_runtime-0.2.0/examples/hybrid-agent/agent.py +65 -0
- akeyless_agentcore_runtime-0.2.0/examples/hybrid-agent/requirements.txt +4 -0
- akeyless_agentcore_runtime-0.2.0/examples/mcp-server/requirements.txt +1 -0
- akeyless_agentcore_runtime-0.2.0/examples/mcp-server/server.py +15 -0
- akeyless_agentcore_runtime-0.2.0/examples/strands-agent/agent.py +58 -0
- akeyless_agentcore_runtime-0.2.0/examples/strands-agent/requirements.txt +9 -0
- akeyless_agentcore_runtime-0.2.0/pyproject.toml +61 -0
- akeyless_agentcore_runtime-0.2.0/src/akeyless_agentcore/__init__.py +17 -0
- akeyless_agentcore_runtime-0.2.0/src/akeyless_agentcore/auth.py +134 -0
- akeyless_agentcore_runtime-0.2.0/src/akeyless_agentcore/cache.py +40 -0
- akeyless_agentcore_runtime-0.2.0/src/akeyless_agentcore/client.py +363 -0
- akeyless_agentcore_runtime-0.2.0/src/akeyless_agentcore/config.py +168 -0
- akeyless_agentcore_runtime-0.2.0/src/akeyless_agentcore/paths.py +79 -0
- akeyless_agentcore_runtime-0.2.0/src/akeyless_agentcore/tools/__init__.py +31 -0
- akeyless_agentcore_runtime-0.2.0/src/akeyless_agentcore/tools/gateway.py +103 -0
- akeyless_agentcore_runtime-0.2.0/src/akeyless_agentcore/tools/mcp.py +70 -0
- akeyless_agentcore_runtime-0.2.0/src/akeyless_agentcore/tools/service.py +144 -0
- akeyless_agentcore_runtime-0.2.0/src/akeyless_agentcore/tools/strands.py +44 -0
- akeyless_agentcore_runtime-0.2.0/tests/test_cache.py +23 -0
- akeyless_agentcore_runtime-0.2.0/tests/test_paths.py +57 -0
- akeyless_agentcore_runtime-0.2.0/tests/test_tools.py +71 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Bootstrap — only Akeyless auth config, NOT application secrets
|
|
2
|
+
AKEYLESS_ACCESS_ID=p-xxxxxxxxxxxx
|
|
3
|
+
AKEYLESS_ACCESS_TYPE=aws_iam
|
|
4
|
+
AKEYLESS_GATEWAY_URL=https://api.akeyless.io
|
|
5
|
+
|
|
6
|
+
# Secret path prefix for this agent (recommended)
|
|
7
|
+
AKEYLESS_SECRET_PREFIX=/bedrock-agentcore/my-agent/production
|
|
8
|
+
AGENTCORE_AGENT_NAME=my-agent
|
|
9
|
+
AKEYLESS_ENV=production
|
|
10
|
+
|
|
11
|
+
# Optional tuning
|
|
12
|
+
# AKEYLESS_SECRET_CACHE_TTL_SECONDS=300
|
|
13
|
+
# AKEYLESS_TOKEN_EXPIRY_MARGIN_SECONDS=60
|
|
14
|
+
|
|
15
|
+
# Local development only — use access_key instead of aws_iam
|
|
16
|
+
# AKEYLESS_ACCESS_TYPE=access_key
|
|
17
|
+
# AKEYLESS_ACCESS_KEY=your-access-key
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.12"]
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
|
+
with:
|
|
20
|
+
python-version: ${{ matrix.python-version }}
|
|
21
|
+
|
|
22
|
+
- run: pip install -e ".[dev]"
|
|
23
|
+
- run: pytest
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
id-token: write
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
publish:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
|
|
20
|
+
- run: pip install build
|
|
21
|
+
- run: python -m build
|
|
22
|
+
|
|
23
|
+
- uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.eggs/
|
|
6
|
+
dist/
|
|
7
|
+
build/
|
|
8
|
+
*.egg
|
|
9
|
+
.venv/
|
|
10
|
+
venv/
|
|
11
|
+
.env
|
|
12
|
+
.env.local
|
|
13
|
+
.env.*.local
|
|
14
|
+
|
|
15
|
+
# Testing / tooling
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.coverage
|
|
18
|
+
htmlcov/
|
|
19
|
+
.mypy_cache/
|
|
20
|
+
.ruff_cache/
|
|
21
|
+
|
|
22
|
+
# IDE
|
|
23
|
+
.idea/
|
|
24
|
+
.vscode/
|
|
25
|
+
*.swp
|
|
26
|
+
.DS_Store
|
|
27
|
+
|
|
28
|
+
# AgentCore local artifacts
|
|
29
|
+
agentcore/
|
|
30
|
+
.gateway_config.json
|
|
31
|
+
gateway_config.json
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thanks for contributing to `akeyless-agentcore-runtime`.
|
|
4
|
+
|
|
5
|
+
## Development setup
|
|
6
|
+
|
|
7
|
+
Requires Python 3.10+.
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
git clone https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git
|
|
11
|
+
cd bedrock-agentcore-akeyless-runtime
|
|
12
|
+
python3 -m venv .venv
|
|
13
|
+
source .venv/bin/activate
|
|
14
|
+
pip install -e ".[dev]"
|
|
15
|
+
pytest
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Optional extras
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install -e ".[mcp]" # MCP server tools
|
|
22
|
+
pip install -e ".[strands]" # Strands in-process tools
|
|
23
|
+
pip install -e ".[gateway]" # AgentCore Gateway Lambda setup
|
|
24
|
+
pip install -e ".[all]" # everything
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Pull requests
|
|
28
|
+
|
|
29
|
+
1. Fork and create a feature branch from `main`.
|
|
30
|
+
2. Add or update tests for behavior changes.
|
|
31
|
+
3. Run `pytest` before opening the PR.
|
|
32
|
+
4. Do not commit real credentials, `.env` files, or gateway tokens.
|
|
33
|
+
5. Keep changes focused — this package should stay small and dependency-light.
|
|
34
|
+
|
|
35
|
+
## Publishing (maintainers)
|
|
36
|
+
|
|
37
|
+
### PyPI (recommended for end users)
|
|
38
|
+
|
|
39
|
+
1. Configure [trusted publishing](https://docs.pypi.org/trusted-publishers/) on PyPI for this GitHub repo
|
|
40
|
+
2. Create a GitHub Release (e.g. `v0.2.0`) — the `publish.yml` workflow uploads automatically
|
|
41
|
+
|
|
42
|
+
Manual fallback:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install build twine
|
|
46
|
+
python -m build
|
|
47
|
+
twine upload dist/*
|
|
48
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
Copyright 2026 Akeyless Community
|
|
8
|
+
|
|
9
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
10
|
+
you may not use this file except in compliance with the License.
|
|
11
|
+
You may obtain a copy of the License at
|
|
12
|
+
|
|
13
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
+
|
|
15
|
+
Unless required by applicable law or agreed to in writing, software
|
|
16
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
17
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
18
|
+
See the License for the specific language governing permissions and
|
|
19
|
+
limitations under the License.
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: akeyless-agentcore-runtime
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Fetch Akeyless secrets at runtime on AWS Bedrock AgentCore using cloud identity authentication
|
|
5
|
+
Project-URL: Homepage, https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime
|
|
6
|
+
Project-URL: Repository, https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime
|
|
7
|
+
Author: Akeyless Community
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: agentcore,akeyless,aws,bedrock,runtime,secrets
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Security
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Requires-Dist: akeyless-cloud-id>=0.3.1
|
|
21
|
+
Requires-Dist: akeyless>=5.0.0
|
|
22
|
+
Provides-Extra: all
|
|
23
|
+
Requires-Dist: bedrock-agentcore-starter-toolkit>=0.1.0; extra == 'all'
|
|
24
|
+
Requires-Dist: mcp>=1.9.0; extra == 'all'
|
|
25
|
+
Requires-Dist: strands-agents>=0.1.0; extra == 'all'
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == 'dev'
|
|
28
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
29
|
+
Provides-Extra: gateway
|
|
30
|
+
Requires-Dist: bedrock-agentcore-starter-toolkit>=0.1.0; extra == 'gateway'
|
|
31
|
+
Provides-Extra: mcp
|
|
32
|
+
Requires-Dist: mcp>=1.9.0; extra == 'mcp'
|
|
33
|
+
Provides-Extra: strands
|
|
34
|
+
Requires-Dist: strands-agents>=0.1.0; extra == 'strands'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# akeyless-agentcore-runtime
|
|
38
|
+
|
|
39
|
+
Fetch [Akeyless](https://www.akeyless.io) secrets at **runtime** on [AWS Bedrock AgentCore](https://aws.amazon.com/bedrock/agentcore/). Authenticate with **cloud identity** (AWS IAM) — no long-lived API keys in your agent deployment. Application secrets stay in Akeyless, not AWS Secrets Manager.
|
|
40
|
+
|
|
41
|
+
**Repository:** [github.com/akeyless-community/bedrock-agentcore-akeyless-runtime](https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime)
|
|
42
|
+
|
|
43
|
+
## Documentation
|
|
44
|
+
|
|
45
|
+
| Guide | Description |
|
|
46
|
+
|-------|-------------|
|
|
47
|
+
| **[Installation](docs/INSTALL.md)** | **pip install — no git clone required** |
|
|
48
|
+
| [Akeyless setup](docs/AKEYLESS_SETUP.md) | Auth method, RBAC, secret paths — do this first |
|
|
49
|
+
| [Deployment patterns](docs/DEPLOYMENT.md) | In-agent fetch, hybrid, MCP server, Gateway Lambda |
|
|
50
|
+
| [Examples](examples/README.md) | Runnable sample agents |
|
|
51
|
+
| [Security](SECURITY.md) | Production checklist and reporting |
|
|
52
|
+
| [Contributing](CONTRIBUTING.md) | Development setup and PR guidelines |
|
|
53
|
+
|
|
54
|
+
## Why this integration?
|
|
55
|
+
|
|
56
|
+
| Concern | AWS default pattern | This integration |
|
|
57
|
+
|---------|--------------------|------------------|
|
|
58
|
+
| **Authentication to secrets platform** | IAM role → Secrets Manager | IAM role → Akeyless (AWS IAM auth method) |
|
|
59
|
+
| **Secret storage** | AWS Secrets Manager | Akeyless (static, dynamic, rotated) |
|
|
60
|
+
| **Bootstrap credentials** | None (IAM only) | Only `AKEYLESS_ACCESS_ID` (no secret key) |
|
|
61
|
+
| **Rotation & governance** | Secrets Manager policies | Akeyless RBAC, rotation, audit |
|
|
62
|
+
|
|
63
|
+
AgentCore Runtime provides an IAM execution role with ambient AWS credentials. This library uses those credentials to generate an Akeyless **cloud ID** and authenticate — the same pattern used by EKS, Lambda, and other Akeyless integrations.
|
|
64
|
+
|
|
65
|
+
## Install
|
|
66
|
+
|
|
67
|
+
**No git clone needed.** Add to your agent project and install with pip.
|
|
68
|
+
|
|
69
|
+
### From PyPI (when published)
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install akeyless-agentcore-runtime
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### From GitHub (available now)
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install "akeyless-agentcore-runtime @ git+https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git@v0.2.0"
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Add to your AgentCore `requirements.txt`:
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
akeyless-agentcore-runtime @ git+https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git@v0.2.0
|
|
85
|
+
bedrock-agentcore>=0.1.0
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Full install guide (extras, MCP CLI, verification): **[docs/INSTALL.md](docs/INSTALL.md)**
|
|
89
|
+
|
|
90
|
+
Optional extras:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
pip install "akeyless-agentcore-runtime[strands] @ git+https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git@v0.2.0"
|
|
94
|
+
pip install "akeyless-agentcore-runtime[mcp] @ git+https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git@v0.2.0"
|
|
95
|
+
pip install "akeyless-agentcore-runtime[gateway] @ git+https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git@v0.2.0"
|
|
96
|
+
pip install "akeyless-agentcore-runtime[all] @ git+https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git@v0.2.0"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Requires **Python 3.10+**.
|
|
100
|
+
|
|
101
|
+
## Quick start
|
|
102
|
+
|
|
103
|
+
### 1. Configure Akeyless
|
|
104
|
+
|
|
105
|
+
Follow the full guide: **[docs/AKEYLESS_SETUP.md](docs/AKEYLESS_SETUP.md)**
|
|
106
|
+
|
|
107
|
+
Summary:
|
|
108
|
+
|
|
109
|
+
1. Create an **AWS IAM Auth Method** bound to your AgentCore execution role ARN
|
|
110
|
+
2. Grant read/list on `/bedrock-agentcore/<agent>/<env>/*`
|
|
111
|
+
3. Store secrets in Akeyless (not in AgentCore env vars)
|
|
112
|
+
|
|
113
|
+
### 2. Set bootstrap env vars on AgentCore
|
|
114
|
+
|
|
115
|
+
Configure only auth + path prefix — **not** application secrets:
|
|
116
|
+
|
|
117
|
+
| Variable | Required | Example |
|
|
118
|
+
|----------|----------|---------|
|
|
119
|
+
| `AKEYLESS_ACCESS_ID` | Yes | `p-xxxxx` |
|
|
120
|
+
| `AKEYLESS_ACCESS_TYPE` | No (default: `aws_iam`) | `aws_iam` |
|
|
121
|
+
| `AKEYLESS_SECRET_PREFIX` | Recommended | `/bedrock-agentcore/my-agent/production` |
|
|
122
|
+
| `AKEYLESS_GATEWAY_URL` | No | `https://api.akeyless.io` |
|
|
123
|
+
| `AGENTCORE_AGENT_NAME` | No | `my-agent` |
|
|
124
|
+
|
|
125
|
+
### 3. Fetch a secret in your agent
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from akeyless_agentcore import get_secret_sync
|
|
129
|
+
|
|
130
|
+
api_key = get_secret_sync("OPENAI_API_KEY")
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### 4. Deploy
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
pip install akeyless-agentcore-runtime bedrock-agentcore
|
|
137
|
+
agentcore deploy
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
See [examples/strands-agent/](examples/strands-agent/) for a complete agent.
|
|
141
|
+
|
|
142
|
+
## In-agent fetch vs AgentCore tools
|
|
143
|
+
|
|
144
|
+
Use **both** in production — they solve different problems:
|
|
145
|
+
|
|
146
|
+
| Pattern | When to use | Example |
|
|
147
|
+
|---------|-------------|---------|
|
|
148
|
+
| **In-agent fetch** | Bootstrap secrets on every invocation; no tool-call overhead | Model API key at cold start |
|
|
149
|
+
| **AgentCore tools** | Agent decides which secret to fetch; shared across agents | `get_akeyless_secret("DATABASE_URL")` on demand |
|
|
150
|
+
| **Hybrid (recommended)** | Bootstrap + on-demand | [examples/hybrid-agent/](examples/hybrid-agent/) |
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
from akeyless_agentcore import get_secret_sync
|
|
154
|
+
from akeyless_agentcore.tools.strands import create_strands_tools
|
|
155
|
+
|
|
156
|
+
api_key = get_secret_sync("OPENAI_API_KEY") # bootstrap
|
|
157
|
+
agent = Agent(model=model, tools=create_strands_tools()) # on-demand
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Tool deployment options
|
|
161
|
+
|
|
162
|
+
| Deployment | Install extra | Use case |
|
|
163
|
+
|------------|---------------|----------|
|
|
164
|
+
| In-process Strands tools | `[strands]` | Tools in the same agent process |
|
|
165
|
+
| MCP server on AgentCore Runtime | `[mcp]` | Dedicated secrets MCP endpoint |
|
|
166
|
+
| Gateway Lambda target | `[gateway]` | Shared tools via AgentCore Gateway |
|
|
167
|
+
|
|
168
|
+
| Tool | Returns values? | Description |
|
|
169
|
+
|------|----------------|-------------|
|
|
170
|
+
| `list_akeyless_secrets` | No | Discover secret names under a prefix |
|
|
171
|
+
| `get_akeyless_secret` | Yes | Fetch static, dynamic, or rotated secret |
|
|
172
|
+
|
|
173
|
+
Full details: **[docs/DEPLOYMENT.md](docs/DEPLOYMENT.md)**
|
|
174
|
+
|
|
175
|
+
## API reference
|
|
176
|
+
|
|
177
|
+
### Convenience functions
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
from akeyless_agentcore import get_secret_sync, get_secret
|
|
181
|
+
|
|
182
|
+
api_key = get_secret_sync("OPENAI_API_KEY")
|
|
183
|
+
api_key = await get_secret("OPENAI_API_KEY") # async
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Client
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
from akeyless_agentcore import AkeylessRuntimeClient
|
|
190
|
+
|
|
191
|
+
client = AkeylessRuntimeClient(
|
|
192
|
+
gateway_url="https://api.akeyless.io",
|
|
193
|
+
secret_prefix="/bedrock-agentcore/my-agent/production",
|
|
194
|
+
access_id="p-xxxxx",
|
|
195
|
+
access_type="aws_iam",
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
client.get_secret_sync("OPENAI_API_KEY")
|
|
199
|
+
client.get_secret_json_sync("APP_CONFIG")
|
|
200
|
+
client.get_dynamic_secret_sync("aws-creds")
|
|
201
|
+
client.get_rotated_secret_sync("api-key")
|
|
202
|
+
client.list_secrets_sync()
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Authentication
|
|
206
|
+
|
|
207
|
+
| Method | `AKEYLESS_ACCESS_TYPE` | Additional env |
|
|
208
|
+
|--------|------------------------|----------------|
|
|
209
|
+
| **AWS IAM (recommended)** | `aws_iam` | `AKEYLESS_ACCESS_ID` |
|
|
210
|
+
| Access key | `access_key` | `AKEYLESS_ACCESS_ID`, `AKEYLESS_ACCESS_KEY` |
|
|
211
|
+
| API key | `api_key` | `AKEYLESS_ACCESS_ID`, `AKEYLESS_ACCESS_KEY` |
|
|
212
|
+
| Universal Identity | `universal_identity` | `AKEYLESS_UID_TOKEN` |
|
|
213
|
+
| JWT | `jwt` | `AKEYLESS_ACCESS_ID`, `AKEYLESS_JWT` |
|
|
214
|
+
| Pre-authenticated | — | `AKEYLESS_TOKEN` |
|
|
215
|
+
|
|
216
|
+
## Architecture
|
|
217
|
+
|
|
218
|
+
```mermaid
|
|
219
|
+
sequenceDiagram
|
|
220
|
+
participant Agent as AgentCore Runtime
|
|
221
|
+
participant Lib as akeyless-agentcore-runtime
|
|
222
|
+
participant AWS as AWS STS/IAM
|
|
223
|
+
participant AKL as Akeyless Gateway
|
|
224
|
+
|
|
225
|
+
Agent->>Lib: get_secret_sync("OPENAI_API_KEY")
|
|
226
|
+
Lib->>AWS: Generate cloud ID (SigV4 GetCallerIdentity)
|
|
227
|
+
AWS-->>Lib: Signed identity proof
|
|
228
|
+
Lib->>AKL: POST /auth (access_id, aws_iam, cloud_id)
|
|
229
|
+
AKL-->>Lib: Session token
|
|
230
|
+
Lib->>AKL: GET /get-secret-value
|
|
231
|
+
AKL-->>Lib: Secret value
|
|
232
|
+
Lib-->>Agent: OPENAI_API_KEY
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## Local development
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
cp .env.example .env # edit with your test credentials — never commit .env
|
|
239
|
+
|
|
240
|
+
export AKEYLESS_ACCESS_ID=p-xxxxx
|
|
241
|
+
export AKEYLESS_ACCESS_TYPE=access_key
|
|
242
|
+
export AKEYLESS_ACCESS_KEY=your-readonly-key
|
|
243
|
+
export AKEYLESS_SECRET_PREFIX=/bedrock-agentcore/my-agent/dev
|
|
244
|
+
|
|
245
|
+
python3 -c "from akeyless_agentcore import get_secret_sync; print(get_secret_sync('OPENAI_API_KEY')[:8] + '...')"
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Related community projects
|
|
249
|
+
|
|
250
|
+
- [netlify-akeyless-runtime](https://github.com/akeyless-community/netlify-runtime) — Netlify Functions
|
|
251
|
+
- [fly-akeyless-runtime](https://github.com/akeyless-community/fly-runtime) — Fly.io Machines
|
|
252
|
+
- [vercel-akeyless-runtime](https://github.com/akeyless-community/vercel-runtime) — Vercel serverless
|
|
253
|
+
- [heroku-akeyless-runtime](https://github.com/akeyless-community/heroku-runtime) — Heroku dynos
|
|
254
|
+
|
|
255
|
+
## License
|
|
256
|
+
|
|
257
|
+
Apache-2.0
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
# akeyless-agentcore-runtime
|
|
2
|
+
|
|
3
|
+
Fetch [Akeyless](https://www.akeyless.io) secrets at **runtime** on [AWS Bedrock AgentCore](https://aws.amazon.com/bedrock/agentcore/). Authenticate with **cloud identity** (AWS IAM) — no long-lived API keys in your agent deployment. Application secrets stay in Akeyless, not AWS Secrets Manager.
|
|
4
|
+
|
|
5
|
+
**Repository:** [github.com/akeyless-community/bedrock-agentcore-akeyless-runtime](https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime)
|
|
6
|
+
|
|
7
|
+
## Documentation
|
|
8
|
+
|
|
9
|
+
| Guide | Description |
|
|
10
|
+
|-------|-------------|
|
|
11
|
+
| **[Installation](docs/INSTALL.md)** | **pip install — no git clone required** |
|
|
12
|
+
| [Akeyless setup](docs/AKEYLESS_SETUP.md) | Auth method, RBAC, secret paths — do this first |
|
|
13
|
+
| [Deployment patterns](docs/DEPLOYMENT.md) | In-agent fetch, hybrid, MCP server, Gateway Lambda |
|
|
14
|
+
| [Examples](examples/README.md) | Runnable sample agents |
|
|
15
|
+
| [Security](SECURITY.md) | Production checklist and reporting |
|
|
16
|
+
| [Contributing](CONTRIBUTING.md) | Development setup and PR guidelines |
|
|
17
|
+
|
|
18
|
+
## Why this integration?
|
|
19
|
+
|
|
20
|
+
| Concern | AWS default pattern | This integration |
|
|
21
|
+
|---------|--------------------|------------------|
|
|
22
|
+
| **Authentication to secrets platform** | IAM role → Secrets Manager | IAM role → Akeyless (AWS IAM auth method) |
|
|
23
|
+
| **Secret storage** | AWS Secrets Manager | Akeyless (static, dynamic, rotated) |
|
|
24
|
+
| **Bootstrap credentials** | None (IAM only) | Only `AKEYLESS_ACCESS_ID` (no secret key) |
|
|
25
|
+
| **Rotation & governance** | Secrets Manager policies | Akeyless RBAC, rotation, audit |
|
|
26
|
+
|
|
27
|
+
AgentCore Runtime provides an IAM execution role with ambient AWS credentials. This library uses those credentials to generate an Akeyless **cloud ID** and authenticate — the same pattern used by EKS, Lambda, and other Akeyless integrations.
|
|
28
|
+
|
|
29
|
+
## Install
|
|
30
|
+
|
|
31
|
+
**No git clone needed.** Add to your agent project and install with pip.
|
|
32
|
+
|
|
33
|
+
### From PyPI (when published)
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
pip install akeyless-agentcore-runtime
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### From GitHub (available now)
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install "akeyless-agentcore-runtime @ git+https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git@v0.2.0"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Add to your AgentCore `requirements.txt`:
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
akeyless-agentcore-runtime @ git+https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git@v0.2.0
|
|
49
|
+
bedrock-agentcore>=0.1.0
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Full install guide (extras, MCP CLI, verification): **[docs/INSTALL.md](docs/INSTALL.md)**
|
|
53
|
+
|
|
54
|
+
Optional extras:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pip install "akeyless-agentcore-runtime[strands] @ git+https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git@v0.2.0"
|
|
58
|
+
pip install "akeyless-agentcore-runtime[mcp] @ git+https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git@v0.2.0"
|
|
59
|
+
pip install "akeyless-agentcore-runtime[gateway] @ git+https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git@v0.2.0"
|
|
60
|
+
pip install "akeyless-agentcore-runtime[all] @ git+https://github.com/akeyless-community/bedrock-agentcore-akeyless-runtime.git@v0.2.0"
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Requires **Python 3.10+**.
|
|
64
|
+
|
|
65
|
+
## Quick start
|
|
66
|
+
|
|
67
|
+
### 1. Configure Akeyless
|
|
68
|
+
|
|
69
|
+
Follow the full guide: **[docs/AKEYLESS_SETUP.md](docs/AKEYLESS_SETUP.md)**
|
|
70
|
+
|
|
71
|
+
Summary:
|
|
72
|
+
|
|
73
|
+
1. Create an **AWS IAM Auth Method** bound to your AgentCore execution role ARN
|
|
74
|
+
2. Grant read/list on `/bedrock-agentcore/<agent>/<env>/*`
|
|
75
|
+
3. Store secrets in Akeyless (not in AgentCore env vars)
|
|
76
|
+
|
|
77
|
+
### 2. Set bootstrap env vars on AgentCore
|
|
78
|
+
|
|
79
|
+
Configure only auth + path prefix — **not** application secrets:
|
|
80
|
+
|
|
81
|
+
| Variable | Required | Example |
|
|
82
|
+
|----------|----------|---------|
|
|
83
|
+
| `AKEYLESS_ACCESS_ID` | Yes | `p-xxxxx` |
|
|
84
|
+
| `AKEYLESS_ACCESS_TYPE` | No (default: `aws_iam`) | `aws_iam` |
|
|
85
|
+
| `AKEYLESS_SECRET_PREFIX` | Recommended | `/bedrock-agentcore/my-agent/production` |
|
|
86
|
+
| `AKEYLESS_GATEWAY_URL` | No | `https://api.akeyless.io` |
|
|
87
|
+
| `AGENTCORE_AGENT_NAME` | No | `my-agent` |
|
|
88
|
+
|
|
89
|
+
### 3. Fetch a secret in your agent
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from akeyless_agentcore import get_secret_sync
|
|
93
|
+
|
|
94
|
+
api_key = get_secret_sync("OPENAI_API_KEY")
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### 4. Deploy
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pip install akeyless-agentcore-runtime bedrock-agentcore
|
|
101
|
+
agentcore deploy
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
See [examples/strands-agent/](examples/strands-agent/) for a complete agent.
|
|
105
|
+
|
|
106
|
+
## In-agent fetch vs AgentCore tools
|
|
107
|
+
|
|
108
|
+
Use **both** in production — they solve different problems:
|
|
109
|
+
|
|
110
|
+
| Pattern | When to use | Example |
|
|
111
|
+
|---------|-------------|---------|
|
|
112
|
+
| **In-agent fetch** | Bootstrap secrets on every invocation; no tool-call overhead | Model API key at cold start |
|
|
113
|
+
| **AgentCore tools** | Agent decides which secret to fetch; shared across agents | `get_akeyless_secret("DATABASE_URL")` on demand |
|
|
114
|
+
| **Hybrid (recommended)** | Bootstrap + on-demand | [examples/hybrid-agent/](examples/hybrid-agent/) |
|
|
115
|
+
|
|
116
|
+
```python
|
|
117
|
+
from akeyless_agentcore import get_secret_sync
|
|
118
|
+
from akeyless_agentcore.tools.strands import create_strands_tools
|
|
119
|
+
|
|
120
|
+
api_key = get_secret_sync("OPENAI_API_KEY") # bootstrap
|
|
121
|
+
agent = Agent(model=model, tools=create_strands_tools()) # on-demand
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Tool deployment options
|
|
125
|
+
|
|
126
|
+
| Deployment | Install extra | Use case |
|
|
127
|
+
|------------|---------------|----------|
|
|
128
|
+
| In-process Strands tools | `[strands]` | Tools in the same agent process |
|
|
129
|
+
| MCP server on AgentCore Runtime | `[mcp]` | Dedicated secrets MCP endpoint |
|
|
130
|
+
| Gateway Lambda target | `[gateway]` | Shared tools via AgentCore Gateway |
|
|
131
|
+
|
|
132
|
+
| Tool | Returns values? | Description |
|
|
133
|
+
|------|----------------|-------------|
|
|
134
|
+
| `list_akeyless_secrets` | No | Discover secret names under a prefix |
|
|
135
|
+
| `get_akeyless_secret` | Yes | Fetch static, dynamic, or rotated secret |
|
|
136
|
+
|
|
137
|
+
Full details: **[docs/DEPLOYMENT.md](docs/DEPLOYMENT.md)**
|
|
138
|
+
|
|
139
|
+
## API reference
|
|
140
|
+
|
|
141
|
+
### Convenience functions
|
|
142
|
+
|
|
143
|
+
```python
|
|
144
|
+
from akeyless_agentcore import get_secret_sync, get_secret
|
|
145
|
+
|
|
146
|
+
api_key = get_secret_sync("OPENAI_API_KEY")
|
|
147
|
+
api_key = await get_secret("OPENAI_API_KEY") # async
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Client
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
from akeyless_agentcore import AkeylessRuntimeClient
|
|
154
|
+
|
|
155
|
+
client = AkeylessRuntimeClient(
|
|
156
|
+
gateway_url="https://api.akeyless.io",
|
|
157
|
+
secret_prefix="/bedrock-agentcore/my-agent/production",
|
|
158
|
+
access_id="p-xxxxx",
|
|
159
|
+
access_type="aws_iam",
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
client.get_secret_sync("OPENAI_API_KEY")
|
|
163
|
+
client.get_secret_json_sync("APP_CONFIG")
|
|
164
|
+
client.get_dynamic_secret_sync("aws-creds")
|
|
165
|
+
client.get_rotated_secret_sync("api-key")
|
|
166
|
+
client.list_secrets_sync()
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Authentication
|
|
170
|
+
|
|
171
|
+
| Method | `AKEYLESS_ACCESS_TYPE` | Additional env |
|
|
172
|
+
|--------|------------------------|----------------|
|
|
173
|
+
| **AWS IAM (recommended)** | `aws_iam` | `AKEYLESS_ACCESS_ID` |
|
|
174
|
+
| Access key | `access_key` | `AKEYLESS_ACCESS_ID`, `AKEYLESS_ACCESS_KEY` |
|
|
175
|
+
| API key | `api_key` | `AKEYLESS_ACCESS_ID`, `AKEYLESS_ACCESS_KEY` |
|
|
176
|
+
| Universal Identity | `universal_identity` | `AKEYLESS_UID_TOKEN` |
|
|
177
|
+
| JWT | `jwt` | `AKEYLESS_ACCESS_ID`, `AKEYLESS_JWT` |
|
|
178
|
+
| Pre-authenticated | — | `AKEYLESS_TOKEN` |
|
|
179
|
+
|
|
180
|
+
## Architecture
|
|
181
|
+
|
|
182
|
+
```mermaid
|
|
183
|
+
sequenceDiagram
|
|
184
|
+
participant Agent as AgentCore Runtime
|
|
185
|
+
participant Lib as akeyless-agentcore-runtime
|
|
186
|
+
participant AWS as AWS STS/IAM
|
|
187
|
+
participant AKL as Akeyless Gateway
|
|
188
|
+
|
|
189
|
+
Agent->>Lib: get_secret_sync("OPENAI_API_KEY")
|
|
190
|
+
Lib->>AWS: Generate cloud ID (SigV4 GetCallerIdentity)
|
|
191
|
+
AWS-->>Lib: Signed identity proof
|
|
192
|
+
Lib->>AKL: POST /auth (access_id, aws_iam, cloud_id)
|
|
193
|
+
AKL-->>Lib: Session token
|
|
194
|
+
Lib->>AKL: GET /get-secret-value
|
|
195
|
+
AKL-->>Lib: Secret value
|
|
196
|
+
Lib-->>Agent: OPENAI_API_KEY
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## Local development
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
cp .env.example .env # edit with your test credentials — never commit .env
|
|
203
|
+
|
|
204
|
+
export AKEYLESS_ACCESS_ID=p-xxxxx
|
|
205
|
+
export AKEYLESS_ACCESS_TYPE=access_key
|
|
206
|
+
export AKEYLESS_ACCESS_KEY=your-readonly-key
|
|
207
|
+
export AKEYLESS_SECRET_PREFIX=/bedrock-agentcore/my-agent/dev
|
|
208
|
+
|
|
209
|
+
python3 -c "from akeyless_agentcore import get_secret_sync; print(get_secret_sync('OPENAI_API_KEY')[:8] + '...')"
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Related community projects
|
|
213
|
+
|
|
214
|
+
- [netlify-akeyless-runtime](https://github.com/akeyless-community/netlify-runtime) — Netlify Functions
|
|
215
|
+
- [fly-akeyless-runtime](https://github.com/akeyless-community/fly-runtime) — Fly.io Machines
|
|
216
|
+
- [vercel-akeyless-runtime](https://github.com/akeyless-community/vercel-runtime) — Vercel serverless
|
|
217
|
+
- [heroku-akeyless-runtime](https://github.com/akeyless-community/heroku-runtime) — Heroku dynos
|
|
218
|
+
|
|
219
|
+
## License
|
|
220
|
+
|
|
221
|
+
Apache-2.0
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting vulnerabilities
|
|
4
|
+
|
|
5
|
+
Report security issues to [security@akeyless.io](mailto:security@akeyless.io). Do not open public GitHub issues for vulnerabilities.
|
|
6
|
+
|
|
7
|
+
## Design principles
|
|
8
|
+
|
|
9
|
+
1. **No application secrets in environment variables** — only bootstrap auth config (`AKEYLESS_ACCESS_ID`, gateway URL, path prefix).
|
|
10
|
+
2. **Cloud identity by default** — `aws_iam` uses the AgentCore execution role; no long-lived Akeyless access keys in production.
|
|
11
|
+
3. **Secrets never logged** — the client returns values to your code only; do not log secret contents.
|
|
12
|
+
4. **In-memory caching** — secrets are cached in process memory with a configurable TTL. Use `ignore_cache=True` for highly sensitive one-time values.
|
|
13
|
+
5. **Least privilege** — bind the Akeyless auth method to the specific AgentCore execution role ARN and restrict to the agent's secret path prefix.
|
|
14
|
+
|
|
15
|
+
## Production checklist
|
|
16
|
+
|
|
17
|
+
- [ ] Use `AKEYLESS_ACCESS_TYPE=aws_iam` (not `access_key`)
|
|
18
|
+
- [ ] Akeyless auth method bound to AgentCore execution role ARN only
|
|
19
|
+
- [ ] Read-only RBAC on `/bedrock-agentcore/<agent>/<env>/*`
|
|
20
|
+
- [ ] No secrets in `agentcore/aws-targets.json` or CloudFormation templates
|
|
21
|
+
- [ ] Gateway URL points to your organization's Akeyless gateway (not a shared dev gateway)
|