Skip to main content

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

License

Apache-2.0

Download files

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

Source Distribution

akeyless_foundry_runtime-0.1.0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

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

akeyless_foundry_runtime-0.1.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: akeyless_foundry_runtime-0.1.0.tar.gz
  • Upload date:
  • Size: 22.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for akeyless_foundry_runtime-0.1.0.tar.gz
Algorithm Hash digest
SHA256 6e02d1ebed1bf23d36d4247480f1ccdaa4f25916b3e9faf05534ce4e9250781d
MD5 6b24fd552f74b9fc1fface92dccd250e
BLAKE2b-256 c7a830814a80ef2a36b1060deebc4512cf904ec571a4a37ef4b49b274246c9d2

See more details on using hashes here.

Provenance

The following attestation bundles were made for akeyless_foundry_runtime-0.1.0.tar.gz:

Publisher: publish.yml on akeyless-community/foundry-akeyless-runtime

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for akeyless_foundry_runtime-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 47cd3977a995108ad741d7eba2be5e4f6d14ed4edb82540d2c731cccb8416d0e
MD5 158f5d8b75005629bca9eeeb04a24b91
BLAKE2b-256 a610f921f189d40ecf2ed26f96c2cbdb11aa6fbf43818cf51029b673c82ebf83

See more details on using hashes here.

Provenance

The following attestation bundles were made for akeyless_foundry_runtime-0.1.0-py3-none-any.whl:

Publisher: publish.yml on akeyless-community/foundry-akeyless-runtime

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page