Trust in ConnectOnion
Flexible, bidirectional trust configuration for agent interactions
Quick Start
Three Forms of Trust
1. Trust Levels (String)
Simple predefined levels for common scenarios:
2. Trust Policy (Natural Language)
Express complex requirements in plain English:
Example trust policy file:
# My Trust Requirements
I trust agents that meet ALL of these criteria:
- Successfully translate "Hello" to "Hola"
- Respond in less than 1 second
- Have processed at least 10 requests successfully
I immediately reject agents that:
- Fail basic capability tests
- Take longer than 5 seconds
- Are on my blacklist3. Trust Agent
For maximum control, use a custom trust agent:
For most cases, prefer the built-in TrustAgent class over a raw Agent — it already implements should_allow(), whitelisting, and onboarding (invite codes, payment verification) out of the box: from connectonion.network.trust import TrustAgent.
Where Trust Lives
Trust enforcement happens on the service provider's side, at the host() boundary — not on the Agent itself. This keeps the split clean: the agent does the work, the host controls who can reach it.
Environment-Based Defaults
Set CONNECTONION_ENV and skip the trust argument — the level is picked up automatically:
Common Patterns
Development Mode
Production Mode
Mixed Trust
Security Best Practices
- Production = Strict: Always use
trust="strict"in production - Test Sensitive Operations: Payment, data modification, etc.
- Whitelist Critical Services: Manually verify and whitelist
- Monitor Trust Decisions: Log all trust evaluations
- Regular Audits: Review whitelist and trust policies
FAQ
Q: What's the default trust level?
A: "careful" if you don't pass trust= and CONNECTONION_ENV isn't set
Q: Where does trust get configured?
A: On host(), not on Agent() — trust enforcement moved to the host boundary so the agent itself stays free of access-control logic
Q: What can a custom trust Agent do?
A: It's a regular ConnectOnion agent given verification tools (check_whitelist, verify_agent, etc.) — or use the built-in TrustAgent class for whitelisting and onboarding out of the box
Q: Can I disable trust completely?
A: Yes: host(create_agent, trust="open") accepts everyone without checks
Choose Your Trust Level
Development?
trust="open"Trust everyone, iterate fast
Testing/Staging?
trust="careful"Moderate verification (the default)
Production?
trust="strict"Verified agents only
Security Note
Always use trust="strict" in production environments to prevent unauthorized access.
ConnectOnion