What is AgentSecrets?
The Zero-Knowledge Difference
How AgentSecrets Works
Installation
Quick Start
Migrating from .env Files
Migrating from Vault / AWS
Migrating from dotenv-vault
Production Checklist
Credential Exposure
What Zero-Knowledge Means
The Proxy Model
The Three-Layer Model
Environments
Agent Identity
Storage Modes
The No get() Principle
Secret-Level Policies
Credential Proxy Overview
Secrets Management
Environments
env Injection
Workspaces & Teams
Projects
Agent Identity
Audit & Governance
account (init / login / logout)
server (get / set / status / reset)
secrets (set / list / delete / push / pull)
proxy (start / stop / status / logs)
call (inject requests via proxy)
env (execute commands with secrets)
workspace (list / create / switch / roles)
project (list / create / use / update)
environment (list / switch / copy / merge)
agent (register / list / tokens)
agent policy (set / get / delete)
logs (list / watch / export / verify)
mcp (serve / install / config)
status (system & session diagnostics)
Aliases & Shortcuts
docs (interactive terminal viewer)
Shell Autocompletion
keychain-auth (daemon & security)
Ecosystem Overview
Zero-Knowledge MCP Server
Integrations Overview
Claude Desktop
Cursor IDE
OpenClaw
HTTP Proxy (Any Client)
LangChain (Native)
CrewAI (Native)
CI/CD Pipeline
SDK Overview
Python SDK
Python API Reference
Python SDK Manual Testing
JavaScript SDK (Soon)
ZK-MCP Integration Guide
Server Overview
5-Layer Architecture
Self-Hosting Guide
Self-Hosting Operations Manual
Server Data Migration
Authentication & Keys
Workspaces & Teams Backend
Projects & Scope Backend
Environments Backend
Secrets & Sync Protocol
Agent Identity Resolution
Telemetry & Metrics Engine
Audit Log Sync
API Endpoint Reference
Cloud Overview & Architecture
The Dual-Engine Model
Cloud Resolver Data Plane
Workload & Agent Tokens
Egress Allowlists & Audit Streams
Cloud REST API Reference
Security Overview
Anti-Impersonation & Process Verification
Encryption Model
Zero-Knowledge Sync
Proxy Security Layers
Threat Model
OWASP Top 10 Mitigation
Security FAQ
Third-Party Audit
Reporting Vulnerabilities
Guides Overview
Building on the SDK
Stripe Integration
OpenAI Integration
Multi-Agent Setup
Onboarding Team
CI/CD Pipeline
Publishing ZK MCP
Rotating Credentials
Auditing Team Activity
Dev to Production
Kubernetes Deployment
Monorepo Setup
Production Proxy Hardening
vs .env Files
vs HashiCorp Vault
vs AWS Secrets Manager
vs dotenv-vault
vs Infisical
When Not to Use
Proxy Not Starting
Proxy Not Resolving
Domain Blocked
Sync Conflicts
MCP Not Connecting
Session Token Errors
Proxy Session Authorization
Keychain Storage & Backends
SSRF & Destination Rules
Installation Issues
Error Codes Reference
Frequently Asked Questions
v3.x
v2.1.0
v2.0.0
v1.4.0
v1.3.x
v1.2.0
v1.1.x
v1.0.x
Secrets & EnvironmentsProxy vs env Injection

Proxy vs. Environment Injection

AgentSecrets provides two specialized, enterprise-grade execution runtimes designed for different architectural boundaries:

  1. The Credential Proxy (agentsecrets proxy / agentsecrets call / Python SDK): Network transport layer credential substitution.
  2. Environment Injection (agentsecrets env -- <command>): Ephemeral process memory injection with real-time stream redaction.

Both runtimes are 100% Zero-Disk (secrets are retrieved from the hardware-backed OS Keychain and never touch .env files). Each runtime is engineered to maximize security within its operational domain.


Architectural Comparison Matrix

Security & Operational FeatureCredential Proxy (Network Layer)Environment Injection (Process Layer)
Primary DomainAutonomous AI Agents, LLM tool calls, HTTP APIsDatabases, background workers, legacy CLIs, Docker
Target BoundaryHTTP / HTTPS outbound requestsOS Process Environment (os.environ / process.env)
Secrets on Physical DiskZero (Never written to disk)Zero (Never written to disk)
Parent Shell ProtectionImmune (Never exported to shell)Immune (Never exported to parent shell or history)
Sibling Process SnoopingImmune (Protected in daemon RAM)Immune (OS kernel memory boundary isolates child)
Terminal & Log Output RedactionBuilt-in (credential_echo defense)Built-in (MaskingWriter multi-encoding scanner)
Exfiltration via Shell envImmune (Key names only)Neutralized (env, printenv, echo $KEY masked to [REDACTED])
Plaintext in Application MemoryZero (Application only holds key names)Localized to Child RAM (Required for DB drivers)
Egress Domain AllowlistingEnforced at the network boundary (proxy/domain-allowlist)Enforced if combined with proxy or host firewall
Integration RequirementRoute HTTP client through proxy (localhost:8765)Zero code changes (prefix command with agentsecrets env --)
Non-HTTP Protocol SupportNo (HTTP/HTTPS only)Universal (Postgres, MySQL, Redis, Kafka, gRPC, raw TCP)

Decision Flowchart: Choosing the Right Runtime

Loading diagram...

Architectural Deep Dive: Two Complementary Security Models

1Network-Layer Proxy Interception (The Zero-Exposure Model)

For autonomous AI agents (LangChain, CrewAI, AutoGen, Claude Desktop, Cursor):

  • The Security Principle: The strongest way to prevent an AI agent from leaking a secret is to ensure the agent never possesses the secret in the first place.
  • How It Works: The application code only references the key name (OPENAI_API_KEY=OPENAI_API_KEY). When the application makes an HTTP request, the independent local proxy daemon intercepts the outbound socket, validates the target domain against the egress allowlist, resolves the secret from the OS Keychain, injects it into the HTTP headers, and transmits it over TLS.
  • The Guarantee: Even if an LLM is completely hijacked via prompt injection and instructed to dump all system memory and variables, it cannot reveal the secret because the secret does not exist anywhere in the application's address space.

2Process-Layer Environment Injection (The Zero-Disk Model)

For full-stack backends, databases, background workers, and containers (Django, FastAPI, Next.js, Celery, Docker):

  • The Security Principle: Database drivers (Postgres, Redis, MySQL) and compiled runtimes physically require credentials in system memory to establish TCP sockets and cannot be routed through HTTP proxies.
  • How It Works: agentsecrets env -- <command> creates a dedicated, isolated child process using the OS execve system call. The decrypted secrets are passed directly into the child process's environment array:
    • Shell Isolation: The variables are never exported into your terminal shell (~/.bashrc, ~/.zsh_history).
    • OS Kernel Memory Isolation: Unrelated processes, sibling terminal tabs, and background scripts running on the machine cannot read the child process's environment block.
    • Real-Time Stream Redaction: The agentsecrets supervisor wraps the child's stdout and stderr in MaskingWriter. If the child process, a crash report, or a diagnostic tool prints os.environ, env, or echo $SECRET, the output is intercepted across chunk boundaries and replaced with [REDACTED].
  • The Guarantee: Complete eradication of plaintext .env files from developer machines and production hosts, total process boundary isolation, and automatic protection against terminal/log leakage.

Combining Both: Enterprise Defense-in-Depth

In modern cloud applications, you don't choose one over the other—you combine both into a seamless defense-in-depth architecture:

  1. Bootstrapping & Internal Services: Use agentsecrets env to inject your database credentials, Redis URLs, and internal secrets into your application process at spawn time.
  2. Third-Party External APIs: Route your outbound API calls (Stripe, OpenAI, Twilio, SendGrid) through the Credential Proxy (agentsecrets call or the Python SDK).

This architectural pattern gives your infrastructure complete zero-disk security for internal systems while providing unbreakable zero-exposure protection for high-value external APIs.

Was this helpful?
Thanks for your feedback!
Your feedback helps us improve the platform.