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 & EnvironmentsProcess Execution (exec)

OpenClaw Exec Provider Protocol (agentsecrets exec)

If you are looking to run terminal commands, servers, or Docker containers with injected environment variables, seeagentsecrets env. The agentsecrets exec command is a dedicated machine-to-machine JSON protocol provider designed for automated agent orchestrators like OpenClaw.


Protocol Overview

The agentsecrets exec command implements a machine-facing JSON interface over standard I/O:

  • It reads an ExecRequest JSON payload from stdin (bounded to a maximum of 10MB).
  • It authenticates against the local keychain-auth daemon.
  • It resolves the requested secret IDs from the OS Keychain for the active project and environment.
  • It writes an ExecResponse JSON payload to stdout.

Because it is designed for automated tooling:

  • All interactive terminal spinners, update banners, and human-facing logs are suppressed.
  • Human-readable error messages are emitted exclusively to stderr in structured formats.
  • The process exits with code 0 on success or code 1 on protocol failure.

Wire Specification (Protocol Version 1)

1Request Payload ()

The caller pipes a single JSON object to the command:

{ "protocolVersion": 1, "provider": "agentsecrets", "ids": [ "STRIPE_SECRET_KEY", "OPENAI_API_KEY", "DATABASE_URL" ] }

Fields:

  • protocolVersion (integer, required): Must be set to 1.
  • provider (string, required): The identifier of the secret provider ("agentsecrets").
  • ids (array of strings, required): The list of secret key names to resolve from the active project.

2Response Payload ()

The command outputs a single JSON response object:

{ "protocolVersion": 1, "values": { "STRIPE_SECRET_KEY": "sk_live_51ABC...", "OPENAI_API_KEY": "sk-proj-xyz..." }, "errors": { "DATABASE_URL": { "message": "secret not found in keychain" } } }

Fields:

  • protocolVersion (integer): Matches the negotiated protocol version (1).
  • values (map of string to string): Successfully resolved secret keys and their decrypted plaintext values.
  • errors (map of string to object, optional): If any requested key could not be resolved (e.g. key missing in active environment), it is returned in the errors map with a descriptive message.

Command Invocation Examples

Testing via Command Line

You can test the protocol directly using shell piping:

echo '{"protocolVersion": 1, "provider": "agentsecrets", "ids": ["STRIPE_KEY"]}' | agentsecrets exec

Programmatic Invocation (Node.js Child Process)

import { spawn } from "child_process"; async function resolveSecrets(keys: string[]): Promise<Record<string, string>> { return new Promise((resolve, reject) => { const child = spawn("agentsecrets", ["exec"]); let stdout = ""; let stderr = ""; child.stdout.on("data", (chunk) => { stdout += chunk; }); child.stderr.on("data", (chunk) => { stderr += chunk; }); child.on("close", (code) => { if (code !== 0) { return reject(new Error(`Exec provider failed (${code}): ${stderr}`)); } try { const response = JSON.parse(stdout); resolve(response.values); } catch (err) { reject(new Error(`Invalid JSON response: ${stdout}`)); } }); const payload = JSON.stringify({ protocolVersion: 1, provider: "agentsecrets", ids: keys, }); child.stdin.write(payload); child.stdin.end(); }); }

Security Guarantees

  • Binary Attestation: keychain-auth validates that the binary calling the OS Keychain is the genuine agentsecrets executable before returning values.
  • Bounded Stdin Reader: To prevent memory exhaustion attacks, agentsecrets exec limits stdin reading to 10MB (MaxExecInputSize).
  • Connection Lifecycle: The keychain-auth socket connection is strictly closed on exit via deferred cleanup.
Was this helpful?
Thanks for your feedback!
Your feedback helps us improve the platform.