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
Server & Self-HostingSelf-Hosting Operations Manual

Self-Hosting Operations Manual

Step-by-step production runbook for deploying, securing, maintaining, and scaling self-hosted AgentSecrets Server clusters.


Deployment Architecture

Public Internet / VPC Edge ┌──────────────────────────┐ │ Cloudflare / Caddy │ (TLS Termination, WAF, Rate Limiting) │ Ports 80 / 443 │ └────────────┬─────────────┘ ┌──────────────────────────┐ │ AgentSecrets Server │ (Uvicorn ASGI Workers) │ Port 8000 │ └────────────┬─────────────┘ ┌─────────────┴─────────────┐ ▼ ▼ ┌────────────────────────┐ ┌────────────────────────┐ │ PostgreSQL Cluster │ │ Daily Metrics Cron │ │ Port 5432 │ │ calculate_metrics │ └────────────────────────┘ └────────────────────────┘

1Quick Start: Docker Compose

For rapid evaluation and local team testing:

git clone https://github.com/The-17/agentsecrets-server.git cd agentsecrets-server </div> # Create environment file cat <<EOF > .env SETTINGS=core.settings.prod SECRET_KEY=$(python3 -c "import secrets; print(secrets.token_urlsafe(50))") ENCRYPTION_KEY=$(python3 -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())") ALLOWED_HOSTS=* POSTGRES_DB=agentsecrets POSTGRES_USER=postgres POSTGRES_PASSWORD=$(python3 -c "import secrets; print(secrets.token_hex(16))") POSTGRES_HOST=db POSTGRES_PORT=5432 POSTGRES_SSLMODE=disable RUN_MIGRATIONS=true COLLECT_STATIC=true EOF # Launch docker-compose up -d

Verify the server is healthy:

curl http://localhost:8000/api/status/health/

2Zero-Disk Hardening: Ingest & Delete

Once the server stack is active, remove unencrypted plaintext files from disk by ingesting the bootstrap environment directly into AgentSecrets:

</div> # 1. Point CLI to your self-hosted server agentsecrets server set http://localhost:8000 agentsecrets init # 2. Create infrastructure project and push secrets agentsecrets project create agentsecrets-server agentsecrets secrets push # 3. Securely delete plaintext bootstrap file rm .env # 4. Run future lifecycle operations with in-memory injection agentsecrets exec -- docker-compose up -d

2Production Enterprise Deployment

Infrastructure Checklist

  1. Virtual Machine: Ubuntu 22.04 LTS or Debian 12 (minimum 2 vCPU, 4 GB RAM).
  2. Dedicated Database: Managed PostgreSQL 15+ (AWS RDS, Google Cloud SQL, Neon, Supabase) with SSL enabled.
  3. DNS Record: An A or CNAME record pointing to your server IP (e.g. api.agentsecrets.yourcompany.com).
  4. Reverse Proxy: Nginx or Caddy with automated Let's Encrypt TLS certificates.

Step-by-Step Server Setup

1. System User & Environment

sudo useradd -m -s /bin/bash agentsecrets sudo -u agentsecrets git clone https://github.com/The-17/agentsecrets-server.git /home/agentsecrets/app cd /home/agentsecrets/app python3 -m venv env source env/bin/activate pip install -r requirements.txt

2. Configure Production Secrets

Create /home/agentsecrets/app/.env with strict 0600 permissions:

SETTINGS=core.settings.prod SECRET_KEY=<SECURE_DJANGO_SECRET> ENCRYPTION_KEY=<FERNET_32_BYTE_BASE64_KEY> ALLOWED_HOSTS=api.agentsecrets.yourcompany.com POSTGRES_DB=agentsecrets POSTGRES_USER=agentsecrets_user POSTGRES_PASSWORD=<STRONG_POSTGRES_PASSWORD> POSTGRES_HOST=your-postgres-host.rds.amazonaws.com POSTGRES_PORT=5432 POSTGRES_SSLMODE=require
sudo chmod 600 /home/agentsecrets/app/.env sudo chown agentsecrets:agentsecrets /home/agentsecrets/app/.env

3. Database Schema Initialization

source env/bin/activate python manage.py migrate --noinput python manage.py collectstatic --noinput

4. systemd Service Configuration

Create /etc/systemd/system/agentsecrets.service:

[Unit] Description=AgentSecrets Server Production ASGI After=network.target [Service] User=agentsecrets Group=agentsecrets WorkingDirectory=/home/agentsecrets/app EnvironmentFile=/home/agentsecrets/app/.env ExecStart=/home/agentsecrets/app/env/bin/gunicorn -k uvicorn.workers.UvicornWorker core.asgi:application --bind 127.0.0.1:8000 --workers 4 --timeout 60 Restart=always RestartSec=5 [Install] WantedBy=multi-user.target
sudo systemctl daemon-reload sudo systemctl enable --now agentsecrets

5. TLS Reverse Proxy (Caddy Example)

Create /etc/caddy/Caddyfile:

api.agentsecrets.yourcompany.com { reverse_proxy 127.0.0.1:8000 encode gzip }
sudo systemctl reload caddy

3Configuring Clients to Use Your Self-Hosted Server

Global Developer Setup

agentsecrets server set https://api.agentsecrets.yourcompany.com agentsecrets init

Pinning a Single Project

cd /path/to/my-repo agentsecrets server set https://api.agentsecrets.yourcompany.com --project

Automated CI/CD Pipelines

export AGENTSECRETS_SERVER_URL="https://api.agentsecrets.yourcompany.com" agentsecrets env -- npm test

4Key Rotation & Disaster Recovery

Key Rotation

To rotate ENCRYPTION_KEY without data loss, provide both keys separated by comma:

ENCRYPTION_KEY="<NEW_PRIMARY_KEY>,<OLD_DECRYPTION_KEY>"

Then run the migration utility:

python manage.py rotate_encryption_key

Automated Backups

pg_dump -U agentsecrets_user -h your-db-host -d agentsecrets -Fc > "agentsecrets_backup_$(date +%Y%m%d).dump"

For full reference details and API specifications, see the Self-Hosting Architecture Reference.

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