Overview
Major feature release adding HashiCorp Vault integration for persistent storage of DID keys and Hydra OAuth2 credentials. This solves the critical issue where pod restarts in Kubernetes deployments resulted in new agent identities and orphaned Hydra OAuth clients. Version: 2026.9.4Date: February 25, 2026
Author: Raahul Dutta
Problem Solved
Before this release
When a pod died and restarted:- โ New DID keys were generated โ different agent identity
- โ New Hydra OAuth client was registered โ orphaned clients in Hydra
- โ Authentication broke โ clients couldnโt authenticate with new credentials
After this release
With Vault enabled:- โ DID keys are restored from Vault โ same agent identity
- โ Hydra credentials are reused โ no duplicate clients
- โ Authentication persists โ seamless pod restarts
Breaking Changes
Features
๐ Vault Client Module
Newbindu/utils/vault_client.py with:
- Store and retrieve DID private/public keys
- Store and retrieve Hydra OAuth2 credentials
- Automatic backup and restore functionality
- Graceful fallback when Vault is unavailable
- Reuses existing AsyncHTTPClient for efficiency (no duplicate HTTP clients)
- Proper async session cleanup to prevent memory leaks
๐ Deterministic Agent Identity
- Agent ID generated deterministically from
SHA256(author:agent_name) - Same author + name โ same agent_id โ same DID every time
- No need to hardcode agent IDs in configuration
- Automatic persistent identity without manual intervention
๐ DID Setup Integration
- Changed default:
recreate_keys=False(wasTrue) - Checks Vault for existing keys before generating new ones
- Automatically backs up newly generated keys to Vault
- Restores keys from Vault on pod restart
- Uses correct filenames from settings (
private.pem,public.pem)
๐ Hydra Registration Integration
Priority-based credential lookup:- Priority 1: Check Vault for existing credentials
- Priority 2: Check local filesystem
- Priority 3: Generate new credentials
- Automatic backup of credentials to Vault
- Reuses
client_secretfrom Vault when recreating clients - Proper VaultClient session cleanup in all code paths
โ๏ธ Configuration
Environment variables:VAULT_ADDR(alternative toVAULT__URL)VAULT_TOKEN(alternative toVAULT__TOKEN)
๐ Documentation
- Complete guide:
docs/VAULT_INTEGRATION.md - Example configuration:
.env.vault.example - Kubernetes deployment examples
- Vault setup instructions
- Troubleshooting guide
๐งช Testing
- Comprehensive unit tests:
tests/unit/test_vault_integration.py - Tests for all Vault operations
- Mock-based testing for CI/CD compatibility
- Updated tests to use correct DID key filenames
๐ง Type Safety & Code Quality
- Proper UUID type handling throughout codebase
- Type-safe agent_id conversion (UUID for internal, str for display)
- No unclosed aiohttp client sessions
- Removed unused dependencies (agno, openai, ddgs)
Technical Details
Storage Hierarchy
Agent ID Generation
- If no explicit ID in config:
SHA256(author:agent_name)[:32]โ UUID - Same author + name = same deterministic agent_id every time
- Agent ID used in DID:
did:bindu:{author}:{agent_name}:{agent_id}
Startup Flow
- Generate deterministic agent_id from
author:agent_name - Check Vault for DID keys โ restore if found โ generate if not found
- Check Vault for Hydra credentials โ reuse if found โ register if not found
- Backup all credentials to Vault
- Start agent with persistent identity
Configuration
Environment Variables
Kubernetes Example
Migration Guide
For Existing Deployments
For New Deployments
Vault Setup
Security Considerations
Performance Impact
- Startup time: +100-200ms for Vault lookups
- Network: Requires Vault connectivity
- Caching: Local files cached after Vault restore
- Failover: Falls back to local files if Vault unavailable
Testing
Unit tests for VaultClient operations
DID key backup and restore
Hydra credential backup and restore
Graceful degradation when Vault disabled
Error handling for network failures
All existing tests passing
Files Changed
New Files
bindu/utils/vault_client.py- VaultClient implementationdocs/VAULT_INTEGRATION.md- Comprehensive integration guide.env.vault.example- Example Vault configurationtests/unit/test_vault_integration.py- Unit tests
Modified Files
bindu/penguin/did_setup.py- Vault restore/backup integrationbindu/penguin/bindufy.py- Deterministic agent_id, Vault config loadingbindu/auth/hydra/registration.py- Vault credential restore/backup, session cleanupbindu/settings.py- VaultSettings documentationbindu/penguin/config_validator.py- recreate_keys default changed to Falsebindu/utils/config_loader.py- Vault config loading from environmentexamples/beginner/.env- DATABASE_URL SSL fixexamples/beginner/.env.example- Vault configuration examplepyproject.toml- Removed unused dependencies (agno, openai, ddgs)
Benefits
๐ฏ Persistent Identity
- Agents maintain the same DID across pod restarts
- No more orphaned OAuth clients in Hydra
- Seamless authentication across deployments
๐ Simplified Operations
- Automatic credential backup and restore
- No manual key management required
- Deterministic agent IDs from configuration
๐ Production Ready
- Kubernetes-native integration
- Graceful degradation when Vault unavailable
- Proper error handling and logging
๐งน Code Quality
- Removed unused dependencies
- Improved type safety
- No resource leaks (proper session cleanup)