akeyless-foundry-runtime
Fetch Akeyless secrets at runtime on Microsoft Foundry Hosted Agents. Authenticate with cloud identity (Azure AD / Entra) — no long-lived API keys in your agent deployment. Application secrets stay in Akeyless, not Azure Key Vault.
Built on the Akeyless Python SDK with Foundry-specific auth defaults, path conventions, caching, and optional MCP tools.
Repository: github.com/akeyless-community/foundry-akeyless-runtime
Documentation
| Guide | Description |
|---|---|
| Installation | pip install — no git clone required |
| Publishing to PyPI | Trusted publishing setup for maintainers |
| Akeyless setup | Auth method, RBAC, secret paths — do this first |
| Foundry deploy | Hosted-agent env vars, Entra identity, invoke — after local test works |
| Deployment patterns | In-agent fetch, hybrid, MCP server |
| Examples | Runnable sample agents |
| Security | Production checklist and reporting |
| Maintainer guide | Branch protection, approvals, PyPI environment |
| Contributing | Development setup and PR guidelines |
Why this integration?
| Concern | Azure default pattern | This integration |
|---|---|---|
| Authentication to secrets platform | Agent identity → Key Vault | Agent Entra identity → Akeyless (Azure AD auth method) |
| Secret storage | Azure Key Vault | Akeyless (static, dynamic, rotated) |
| Bootstrap credentials | None (managed identity) | Only AKEYLESS_ACCESS_ID (no secret key) |
| Rotation & governance | Key Vault policies | Akeyless RBAC, rotation, audit |
Foundry Hosted Agents assign a dedicated Microsoft Entra identity at deploy time. This library uses that identity to generate an Akeyless cloud ID and authenticate — the same Azure AD pattern used by AKS, Functions, and other Akeyless integrations.
Install
No git clone needed. Add to your agent project and install with pip.
From PyPI (recommended once published)
pip install akeyless-foundry-runtime
See docs/PYPI_PUBLISHING.md for maintainer setup. The package is not on PyPI yet — use GitHub install below until the first release is published.
From GitHub (available once the repo is public)
pip install "akeyless-foundry-runtime @ git+https://github.com/akeyless-community/foundry-akeyless-runtime.git@v0.1.0"
Add to your Foundry agent requirements.txt:
akeyless-foundry-runtime @ git+https://github.com/akeyless-community/foundry-akeyless-runtime.git@v0.1.0
Full install guide: docs/INSTALL.md
Requires Python 3.10+.
Quick start
1. Configure Akeyless
Follow docs/AKEYLESS_SETUP.md — create an Azure AD Auth Method, RBAC, and store secrets under /foundry-agents/<agent>/<env>/.
2. Test locally
cp .env.example .env # edit with access_key auth for local test
python3 -c "from akeyless_foundry import get_secret; print('OK' if get_secret('APP_SECRET') else 'empty')"
Do not print secret values.
3. Deploy to Foundry
Follow docs/FOUNDRY_DEPLOY.md — set bootstrap env vars on the hosted agent, bind the agent Entra object ID in Akeyless, deploy, then invoke.
4. Set bootstrap env vars on the hosted agent
Configure only auth + path prefix — not application secrets:
| Variable | Required | Example |
|---|---|---|
AKEYLESS_ACCESS_ID |
Yes | p-xxxxx |
AKEYLESS_ACCESS_TYPE |
No (default: azure_ad) |
azure_ad |
AKEYLESS_SECRET_PREFIX |
Recommended | /foundry-agents/my-agent/production |
AKEYLESS_GATEWAY_URL |
No | https://api.akeyless.io |
FOUNDRY_AGENT_NAME |
No | my-agent |
5. Fetch a secret in your agent
from akeyless_foundry import get_secret
app_secret = get_secret("APP_SECRET")
6. Deploy
Package and deploy as a Foundry Hosted Agent (container or source zip). See examples/hosted-agent/.
Two ways to retrieve secrets
| API | Who calls it | Purpose |
|---|---|---|
get_secret() |
Your Python code | Bootstrap secrets at startup |
get_akeyless_secret (tool) |
The LLM / MCP client | On-demand secrets via MCP |
Both use the same Akeyless SDK under the hood (auth + get-secret-value / get-dynamic-secret-value / get-rotated-secret-value). The tool adds a JSON response layer.
from akeyless_foundry import get_secret, AkeylessRuntimeClient
app_secret = get_secret("APP_SECRET")
client = AkeylessRuntimeClient()
client.get_dynamic_secret("azure-creds")
client.get_rotated_secret("api-key")
API reference
get_secret(name) — fetch a secret from your code
from akeyless_foundry import get_secret
value = get_secret("APP_SECRET")
AkeylessRuntimeClient — full client
from akeyless_foundry import AkeylessRuntimeClient
client = AkeylessRuntimeClient(
gateway_url="https://api.akeyless.io",
secret_prefix="/foundry-agents/my-agent/production",
access_id="p-xxxxx",
access_type="azure_ad",
)
client.get_secret("APP_SECRET")
client.get_secret_json("APP_CONFIG")
client.get_dynamic_secret("azure-creds")
client.get_rotated_secret("api-key")
client.list_secrets()
Agent tools — get_akeyless_secret / list_akeyless_secrets
# pip install 'akeyless-foundry-runtime[mcp]'
from akeyless_foundry.tools.mcp import run_mcp_server
Authentication
| Method | AKEYLESS_ACCESS_TYPE |
Additional env |
|---|---|---|
| Azure AD (recommended) | azure_ad |
AKEYLESS_ACCESS_ID |
| Access key | access_key |
AKEYLESS_ACCESS_ID, AKEYLESS_ACCESS_KEY |
| API key | api_key |
AKEYLESS_ACCESS_ID, AKEYLESS_ACCESS_KEY |
| Universal Identity | universal_identity |
AKEYLESS_UID_TOKEN |
| JWT | jwt |
AKEYLESS_ACCESS_ID, AKEYLESS_JWT |
| Pre-authenticated | — | AKEYLESS_TOKEN |
Architecture
sequenceDiagram
participant Agent as Foundry Hosted Agent
participant Lib as akeyless-foundry-runtime
participant Entra as Entra / IMDS
participant AKL as Akeyless Gateway
Agent->>Lib: get_secret("APP_SECRET")
Lib->>Entra: Generate cloud ID (Azure AD token)
Entra-->>Lib: Identity token
Lib->>AKL: POST /auth (access_id, azure_ad, cloud_id)
AKL-->>Lib: Session token
Lib->>AKL: GET /get-secret-value
AKL-->>Lib: Secret value
Lib-->>Agent: APP_SECRET
Local development
export AKEYLESS_ACCESS_ID=p-xxxxx
export AKEYLESS_ACCESS_TYPE=access_key
export AKEYLESS_ACCESS_KEY=your-readonly-key
export AKEYLESS_SECRET_PREFIX=/foundry-agents/my-agent/dev
python3 -c "from akeyless_foundry import get_secret; print('fetched' if get_secret('APP_SECRET') else 'empty')"
Related community projects
- bedrock-agentcore-akeyless-runtime — AWS Bedrock AgentCore
- netlify-akeyless-runtime — Netlify Functions
- fly-akeyless-runtime — Fly.io Machines
License
Apache-2.0
Metadata
Release files for akeyless-foundry-runtime 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| akeyless_foundry_runtime-0.1.0.tar.gz | 22.2 kB | With provenance | Details for akeyless_foundry_runtime-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| akeyless_foundry_runtime-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for akeyless_foundry_runtime-0.1.0-py3-none-any.whl |
Total release size: 37.7 kB
Release files / akeyless_foundry_runtime-0.1.0.tar.gz
| Download URL | akeyless_foundry_runtime-0.1.0.tar.gz |
|---|---|
| Size | 22.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6e02d1ebed1bf23d36d4247480f1ccdaa4f25916b3e9faf05534ce4e9250781d
|
|
BLAKE2b-256 checksum How to use checksums |
c7a830814a80ef2a36b1060deebc4512cf904ec571a4a37ef4b49b274246c9d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logRelease files / akeyless_foundry_runtime-0.1.0-py3-none-any.whl
| Download URL | akeyless_foundry_runtime-0.1.0-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
47cd3977a995108ad741d7eba2be5e4f6d14ed4edb82540d2c731cccb8416d0e
|
|
BLAKE2b-256 checksum How to use checksums |
a610f921f189d40ecf2ed26f96c2cbdb11aa6fbf43818cf51029b673c82ebf83
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logSecurity for akeyless-foundry-runtime 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for akeyless_foundry_runtime-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.