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
SDKPython SDK Manual Testing

Python SDK Manual Testing

This guide describes how to verify the connection, request interception, and mock capabilities of the Python SDK.


1Environment Configuration

Follow these steps to prepare your local terminal and CLI daemon before running any SDK tests:

Step A: Configure the Workspace & Mock Secrets

# Reset local CLI config agentsecrets init --force # Create test scope agentsecrets workspace create "Test Workspace" agentsecrets project create "sdk-test-project" agentsecrets environment switch "development" # Set a mock credential value in your OS Keychain agentsecrets secrets set MOCK_SERVICE_KEY="mock_secret_value_12345" # Authorize the target domain agentsecrets workspace allowlist add httpbin.org

Step B: Start the daemon

agentsecrets proxy start

2Manual Test Cases

Test 1: Verify Connection & Status

Verify that the SDK connects to the active daemon session and resolves context.

Create test_status.py:

from agentsecrets import AgentSecrets # Initialize client client = AgentSecrets() # Verify connection to local daemon status = client.proxy.status() print(f"✓ Connected on Port: {status.port}")
python test_status.py # Expected Output: # ✓ Connected on Port: 8765

Test 2: Secure API Calls (client.call())

Verify that credentials are dynamically resolved from your OS Keychain and injected at the transport boundary.

Create test_call.py:

from agentsecrets import AgentSecrets client = AgentSecrets() # Target httpbin to inspect request headers (the proxy will automatically redact # the reflected credential in the response before returning it to the SDK). response = client.call( "https://httpbin.org/headers", method="GET", bearer="MOCK_SERVICE_KEY" ) headers = response.json().get("headers", {}) print(f"✓ Authorization Injected: {headers.get('Authorization')}")
python test_call.py # Expected Output: # ✓ Authorization Injected: Bearer [REDACTED]

Test 3: Transparent Interception (init())

Verify that outgoing calls made by standard libraries (requests and httpx) are intercepted.

Create test_interception.py:

import httpx import requests from agentsecrets import init, credential # Register global interception hooks init() # 1. Verify requests library interception res_req = requests.get( "https://httpbin.org/headers", headers={"Authorization": f"Bearer {credential.MOCK_SERVICE_KEY}"} ) auth_req = res_req.json().get("headers", {}).get("Authorization") print(f"✓ Intercepted requests: {auth_req}") # 2. Verify httpx library interception with httpx.Client() as client: res_httpx = client.get( "https://httpbin.org/headers", headers={"Authorization": f"Bearer {credential.MOCK_SERVICE_KEY}"} ) auth_httpx = res_httpx.json().get("headers", {}).get("Authorization") print(f"✓ Intercepted httpx: {auth_httpx}")
python test_interception.py # Expected Output: # ✓ Intercepted requests: Bearer [REDACTED] # ✓ Intercepted httpx: Bearer [REDACTED]

3Clean Up

Shut down the daemon and reset the configuration:

agentsecrets proxy stop agentsecrets init --force
Was this helpful?
Thanks for your feedback!
Your feedback helps us improve the platform.