This release is a pre-release and may not be stable for production use.
AgentGuardKit
Tenant-isolated credential brokering, deny-by-default capabilities, and typed audit sanitization for AI agents.
The Problem: Why LLM Agents Break Traditional Secrets Management
Most secrets managers (HashiCorp Vault, AWS Secrets Manager, Doppler) store credentials securely at rest and return them upon authentication. However, when an autonomous AI agent interacts with third-party tools, yielding raw plaintext credentials directly to the agent runtime creates severe vulnerabilities:
- Prompt Injection & Exfiltration: LLMs process instructions and untrusted data (user emails, scraped web content, tool responses) in the same context window. If a long-lived API key or OAuth token enters the model's prompt or context, indirect prompt injection can induce the agent to emit or transmit that secret. System prompts are not security boundaries.
- Over-Privileged Non-Human Identities: Agents executing autonomous sub-tasks often receive broad service account permissions rather than tightly scoped, tenant-isolated credentials.
- Audit Blindness: Tracing tools and LLM observability platforms often capture unredacted tool inputs and error dumps, inadvertently recording sensitive authentication material in telemetry tables.
What AgentGuardKit Provides
AgentGuardKit is a lightweight, embeddable Python security library that introduces a brokered credential isolation layer between autonomous agents and secret stores:
- Plaintext Credential Withholding: AI agents receive only opaque references and capability proposals—never raw tokens.
- Tenant-Scoped Authorization & Path Isolation: Requires an explicit, host-authenticated
AuthorizationContextbinding callers to permitted tenant and connector scopes. - Deny-by-Default Capability Engine: Non-overridable security invariants unconditionally prohibit agents from reading decrypted credentials, requiring human-in-the-loop sign-off for lifecycle operations.
- Optimistic Concurrency & Compensating Rollback: Enforces CAS=0 on registration to prevent overwriting existing keys, CAS on rotation to prevent lost updates, and version-scoped compensating deletion with structured recovery records if metadata persistence fails.
- Strict Typed Audit Sanitization: Scrubs telemetry and logs using typed scalar allowlists (IPs, HTTP verbs, status codes) and regex pattern scrubbers (AWS keys, GitHub tokens, Bearer headers, JWTs).
- Framework-Independent & Zero Runtime Dependencies: Pure Python standard library implementation (
urllib.request,ssl,json,dataclasses). No mandatory Django, FastAPI, or third-party HTTP client dependencies.
Security Boundary & Host Application Responsibilities
Installation
# Direct installation from PyPI
pip install agent-guard-kit-sdk
# Or installation from source
git clone https://github.com/techmsd/agent-guard-kit.git
cd agent-guard-kit
pip install -e .
(Note: The official distribution package name on PyPI is agent-guard-kit-sdk. The Python import namespace remains agentguardkit.)
Quick Start
1. In-Memory Mock (for Local Development & Tests)
from agentguardkit import (
CredentialBroker,
SecretPayload,
AgentRole,
AuthorizationContext,
MockVaultStorage,
)
# Initialize standalone broker with mock storage
storage = MockVaultStorage()
broker = CredentialBroker(storage=storage)
# Operator authorization context supplied by trusted host application
admin_ctx = AuthorizationContext(
actor_id="admin_user",
role=AgentRole.HUMAN_ADMIN,
permitted_tenants=frozenset({"tenant_acme"}),
permitted_connectors=frozenset({"stripe_payments"}),
is_authenticated=True,
)
# Register a credential
payload = SecretPayload(
secret_type="api_key",
secret_value="synthetic_token_12345",
description="Primary payment gateway connector",
)
result = broker.register_secret(
tenant_id="tenant_acme",
connector_id="stripe_payments",
payload=payload,
auth_context=admin_ctx,
)
print("Registered:", result)
# AI agents attempting to decrypt credentials are denied fail-closed
from agentguardkit.exceptions import UnauthorizedActionError
agent_ctx = AuthorizationContext(
actor_id="specialist_agent",
role=AgentRole.SPECIALIST,
permitted_tenants=frozenset({"tenant_acme"}),
is_authenticated=True,
)
try:
broker.policy_engine.enforce(
auth_context=agent_ctx,
action="vault:decrypt_value",
tenant_id="tenant_acme",
connector_id="stripe_payments",
)
except UnauthorizedActionError as e:
print("Blocked agent action:", e)
2. HashiCorp Vault KV v2 Production Storage
from agentguardkit.storage.kv2 import HashiCorpVaultKV2Storage
# Enforces remote HTTPS and TLS certificate verification fail-closed
storage = HashiCorpVaultKV2Storage(
base_url="https://vault.internal.corp:8200",
mount_point="secret",
token="s.synthetic_vault_token",
verify_ssl=True,
timeout=5.0,
)
3. Strict Audit Sanitization
from agentguardkit import AuditSanitizer
sanitizer = AuditSanitizer()
raw_telemetry = {
"ip": "10.0.0.1",
"method": "POST",
"status_code": 200,
"user_agent": "Mozilla/5.0 Bearer ya29.secretBearerToken123",
"password": "RawPasswordMustBeScrubbed",
"admin_note": "Rotated synthetic token for prod",
}
clean = sanitizer.sanitize(raw_telemetry)
print(clean)
# Output: {'ip': '10.0.0.1', 'method': 'POST', 'status_code': 200}
Implemented vs. Future Roadmap
| Capability | Status in v0.1.0a3 | Notes |
|---|---|---|
| Tenant Path Derivation | Implemented & Tested | Canonical hierarchical validation (^[a-zA-Z0-9_-]+$) |
| Tenant Authorization Context | Implemented & Tested | Explicit AuthorizationContext scope binding fail-closed |
| Pluggable Storage Protocol | Implemented & Tested | SecretStorageBackend protocol |
| HashiCorp Vault KV v2 | Implemented & Tested | Pure Python TLS REST adapter with schema validation |
| Mock Vault Storage | Implemented & Tested | Thread-safe in-memory engine with fault injection |
| CAS Concurrency | Implemented & Tested | CAS=0 registration and CAS version rotation |
| Compensating Rollback | Implemented & Tested | Version rollback with structured recovery records |
| Deny-by-Default Policy | Implemented & Tested | In-process capability engine with non-overridable invariants |
| Typed Audit Sanitizer | Implemented & Tested | Typed allowlists and regex pattern scrubbing |
| Django / FastAPI Adapters | Future Roadmap | Optional framework integrations |
| Remote MCP Gateway | Future Roadmap | Brokered tool proxy executing outside LLM context |
Metadata
Release files for agent-guard-kit-sdk 0.1.0a3
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 |
|---|---|---|---|---|
| agent_guard_kit_sdk-0.1.0a3.tar.gz | 54.4 kB | With provenance | Details for agent_guard_kit_sdk-0.1.0a3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agent_guard_kit_sdk-0.1.0a3-py3-none-any.whl | Python 3 | none | any | Details for agent_guard_kit_sdk-0.1.0a3-py3-none-any.whl |
Total release size: 89.7 kB
Release files / agent_guard_kit_sdk-0.1.0a3.tar.gz
| Download URL | agent_guard_kit_sdk-0.1.0a3.tar.gz |
|---|---|
| Size | 54.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c15b99584b9e72606d907a2142fb6359e3fb689a07d0ba22635cbd394b810174
|
|
BLAKE2b-256 checksum How to use checksums |
8b669f7216c7a762010e9725dedec2cd15b43f677f7dffcae0b8d6227b57827e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 25, 2026.
Transparency logRelease files / agent_guard_kit_sdk-0.1.0a3-py3-none-any.whl
| Download URL | agent_guard_kit_sdk-0.1.0a3-py3-none-any.whl |
|---|---|
| Size | 35.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b22bcccd95efb8be1ea0628a6a3b0678976888ab8310bf6fc78bdbb4194a5e81
|
|
BLAKE2b-256 checksum How to use checksums |
f347ee928b31582088343e5f3ab429f64b0c683de751f6a79c1ed2780cc299b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 25, 2026.
Transparency logSecurity for agent-guard-kit-sdk 0.1.0a3
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
Both files in this release have been uploaded with provenance metadata.
Attestation for agent_guard_kit_sdk-0.1.0a3.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 Nov 25, 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.