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
IntegrationsLangChain (Soon)

LangChain Integration

AgentSecrets integrates natively with LangChain to ensure your agents can authenticate with external APIs without ever holding the plaintext credentials in their context or memory.


The Zero-Knowledge Tool Pattern

When building LangChain tools (@tool or BaseTool), you traditionally inject API keys into the tool's environment or initialization parameters. With AgentSecrets, you configure the tool to route its underlying HTTP client through the local AgentSecrets proxy.

Example: Custom LangChain Tool

  1. Store your secret:

    agentsecrets secrets set STRIPE_KEY=sk_live_...
  2. Authorize the domain:

    agentsecrets workspace allowlist add api.stripe.com
  3. Build the Tool: Instead of using os.environ["STRIPE_KEY"], configure your Python requests client to use the proxy injection headers:

    import requests from langchain_core.tools import tool @tool def fetch_stripe_balance() -> str: """Fetches the current account balance from Stripe.""" # The proxy runs on localhost:8765 proxies = { "http": "http://localhost:8765", "https": "http://localhost:8765" } # Tell the proxy which credential to resolve headers = { "X-AS-Target-URL": "https://api.stripe.com/v1/balance", "X-AS-Inject-Bearer": "STRIPE_KEY" } # Send the request to the proxy response = requests.get( "http://localhost:8765/proxy", headers=headers ) return response.text

By defining your LangChain tools this way, the agent can reason about the tool and invoke it, but the agent's memory window and process environment remain completely free of the STRIPE_KEY.


Native LangChain Python SDK (Coming Soon)

A native Python SDK for LangChain is currently in development. It will provide a zero-knowledge HTTP client and a native AgentSecretsTool class that automatically handles proxy routing, certificate verification, and header injection.

Until the native SDK is released, use the HTTP proxy routing method described above.

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