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
Cloud Overview & Architecture
The Dual-Engine Model
Cloud Resolver Data Plane
Workload & Agent Tokens
Egress Allowlists & Audit Streams
Cloud REST API Reference
Account (init / login)
Server & Self-Hosting (server)
Docs
Shell Autocompletion
Keychain Auth
Secrets
Environments
Credential Proxy
env Injection
Workspaces & Teams
Projects
Agent Identity
Audit & Governance
Integrations Overview
Claude Desktop
Cursor
OpenClaw
HTTP Proxy (Any)
LangChain (Soon)
CrewAI (Soon)
CI/CD Pipeline
SDK Overview
Python SDK
Python API Reference
Python SDK Manual Testing
JavaScript SDK (Soon)
Ecosystem Overview
Zero-Knowledge MCP Server
Server Overview
5-Layer Architecture
Self-Hosting Guide
Authentication & Keys
Workspaces & Teams
Projects & Scope
Environments
Secrets & Sync Protocol
Agent Identity Resolution
Telemetry & Metrics Engine
Audit Log Sync
API Endpoint 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.1.x
v3.0.0
v2.1.0
v2.0.0
v1.4.0
v1.3.x
v1.2.0
v1.1.x
v1.0.x
Getting StartedMigrating from .env Files

Migrating from .env Files

If your current setup relies on .env files, this guide walks you through moving to AgentSecrets. You can run both in parallel during the transition and cut over when you are ready.


Why .env files are risky with AI agents

.env files are particularly dangerous when using AI agents. Since agents often have filesystem access, they can inadvertently read or leak your secrets if they are stored in plaintext on disk.

AgentSecrets eliminates all of these vectors by keeping the value out of the filesystem (in keychain-only mode), out of environment variables, and out of any accessible process context.


Importing your existing .env

# Confirm you are in the right project and environment agentsecrets status # Import from .env or .env.development agentsecrets secrets push

This reads your .env file, encrypts each value locally, uploads the encrypted blobs to cloud, and writes to the OS keychain. After verifying with agentsecrets secrets list and agentsecrets secrets diff, you can delete the .env file.


Replacing dotenv calls with AgentSecrets

Before:

from dotenv import load_dotenv import os import requests load_dotenv() response = requests.get( "https://api.stripe.com/v1/balance", headers={"Authorization": f"Bearer {os.getenv('STRIPE_KEY')}"} )

After:

from agentsecrets import AgentSecrets client = AgentSecrets() response = client.call( "https://api.stripe.com/v1/balance", bearer="STRIPE_KEY" )

The value never enters your Python process. client.call() routes the request through the local proxy, which handles resolution and injection.


Using agentsecrets env as a drop-in replacement

For tools and frameworks that read from environment variables at startup and cannot be modified to use the SDK or proxy, agentsecrets env is the closest drop-in:

# Before node server.js # After agentsecrets env -- node server.js

Values are injected into the child process at spawn time. The parent process never holds them. Nothing is written to disk. When the process exits, the values are gone.

This is a stronger guarantee than a .env file, but weaker than the proxy — the child process does hold the values in its environment for the duration of the process. For AI agents specifically, prefer the SDK or proxy. For non-agent tools and frameworks that cannot be modified, agentsecrets env is the right path. See Proxy Injection vs env Injection for a full comparison.

if you use makefile, the lowest-friction way to useagentsecrets env in a project is to define a RUN variable at the top of your Makefile and prefix commands with it. This way you type make dev and not agentsecrets env -- npm run dev.

RUN := agentsecrets env -- dev: $(RUN) npm run dev test: $(RUN) npm test

Migration checklist

Run agentsecrets init and create your project
Run agentsecrets secrets push to import your .env
Run agentsecrets secrets list to verify all keys are stored
Run agentsecrets secrets diff to verify cloud sync
Add your domains to the allowlist with agentsecrets workspace allowlist add
Start the proxy with agentsecrets proxy start
Update your code to use the SDK, proxy, or agentsecrets env
Test your updated code end-to-end
Delete your .env file
Add .env and .env.* to .gitignore if not already there
Was this helpful?
Thanks for your feedback!
Your feedback helps us improve the platform.