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
CLI Referenceagent policy (set / get / delete)

Agent Policy (Capabilities) & Secret Constraints

To ensure fine-grained control and zero-trust security when deploying AI agents, AgentSecrets implements two key enforcement layers on top of your credentials: Agent Policies (Capabilities) and Secret Constraints.


Agent Policies (Capabilities)

Agent Policies allow you to bind permissions directly to an agent identity. They specify which secrets a given agent token (agt_...) can inject.

By default, an agent has access to all secrets within its project/workspace scope. Once you configure a policy, access is restricted to the whitelist or blacklist you define.

Commands

Get Agent Policy

To inspect the policy configured for an agent:

agentsecrets agent policy get <agent-name>

Set Agent Policy

To restrict an agent to specific keys (whitelisting) using a comma-separated list or repeatable flags:

# Comma-separated list agentsecrets agent policy set <agent-name> --allow GITHUB_TOKEN,SERP_KEY # Repeatable flags agentsecrets agent policy set <agent-name> --allow GITHUB_TOKEN --allow SERP_KEY

To block an agent from accessing specific sensitive keys (blacklisting):

# Comma-separated list agentsecrets agent policy set <agent-name> --deny STRIPE_SECRET_KEY,AWS_SECRET_ACCESS_KEY # Repeatable flags agentsecrets agent policy set <agent-name> --deny STRIPE_SECRET_KEY --deny AWS_SECRET_ACCESS_KEY

  • Setting agent policies is a sensitive administrative action. The CLI will prompt you for your workspace/project password to authenticate the changes.
  • Secrets must exist locally or remotely in the project before you can bind them to an agent policy. Providing a key that does not exist will fail the command with a SEC-404 validation error.

Secret Constraints

Secret Constraints define rules bound to the secret key itself, regardless of which agent is requesting it. They restrict the target domains and HTTP methods that are permitted to receive the credential.

Structure of a Constraint

A constraint rule dictates:

  1. Target Domains: A list of domains where the key can be sent (e.g. api.stripe.com). If specified, sending this key to any other domain is blocked.
  2. Method Actions: Actions mapped to HTTP methods (GET, POST, etc.):
    • allow: Seamless injection.
    • deny: Hard block.
    • request_permission: Runtime developer approval required.

Commands

View Secret Policy

To inspect the current policy/constraints of a secret key:

agentsecrets secrets policy get <KEY>

Set Secret Policy

To bind target constraints to a secret:

agentsecrets secrets policy set <KEY> --domains api.stripe.com --methods GET,POST --action request_permission

Alternatively, to bind domain-specific method rules:

agentsecrets secrets policy set <KEY> --rule api.stripe.com:GET=allow,POST=request_permission

Clear Secret Policy

To remove all target constraints from a secret:

agentsecrets secrets policy delete <KEY>

Modifying secret policies requires password verification.


Runtime Approvals

If a secret constraint specifies request_permission for an HTTP method and domain, the proxy will temporarily pause the outgoing request and return a 403 Forbidden response to the agent, specifying that developer approval is required.

To authorize the request session-wide (until the proxy is restarted), run the approval command in your developer terminal:

agentsecrets proxy approve <KEY> <METHOD> <DOMAIN>

Once approved, the agent can successfully re-run the request and the proxy will inject the secret.

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