ConnectOnionConnectOnion
Core Feature

Trust in ConnectOnion

Flexible, bidirectional trust configuration for agent interactions

Read: Why we chose "trust" as our keyword

Quick Start

trust_config.py
1from connectonion import Agent, need 2 3# Simple trust levels 4translator = need("translate", trust="strict") # Production: verified only 5analyzer = need("analyze", trust="tested") # Default: test first 6scraper = need("scrape", trust="open") # Development: trust all 7 8# For your own agent 9agent = Agent( 10 name="my_service", 11 tools=[process_data], 12 trust="strict" # Who can use my services 13)
Python REPL
Interactive
>>> translator = need("translate", trust="strict")
>>> print(translator)
<Agent: translate (strict trust)>
 
>>> agent = Agent(name="my_service", tools=[process_data], trust="strict")
>>> print(f"Agent {agent.name} configured with strict trust policy")

Three Forms of Trust

1. Trust Levels (String)

Simple predefined levels for common scenarios:

openTrust everyone (development)
testedTest before trusting (default)
strictOnly verified/whitelisted (production)

2. Trust Policy (Natural Language)

Express complex requirements in plain English:

natural_language_trust.py
1trust = """ 2I trust agents that: 3- Pass capability tests 4- Respond within 500ms 5- Are on my whitelist OR from local network 6""" 7 8translator = need("translate", trust=trust)

3. Trust Agent

For maximum control, use a custom trust agent with verification tools

trust_agent.py
1trust_agent = Agent( 2 name="my_guardian", 3 tools=[check_whitelist, verify_capability], 4 system_prompt="You verify other agents before allowing interaction." 5) 6 7# Use it for your services 8my_agent = Agent( 9 name="my_service", 10 tools=[process_payment], 11 trust=trust_agent # Guardian protects your agent 12)

Bidirectional Trust

The same trust parameter works in both directions:

bidirectional_trust.py
1from connectonion import Agent, need, share 2 3# Alice creates a translation service 4alice = Agent( 5 name="alice_translator", 6 tools=[translate], 7 trust="tested" # Test users before serving them 8) 9share(alice) # Make Alice available to others 10 11# Bob looks for a translator 12translator = need( 13 "translate to Spanish", 14 trust="strict" # Bob only uses verified services 15) 16 17# What happens: 18# 1. Bob's trust agent evaluates Alice (strict check) 19# 2. Alice's trust agent evaluates Bob (test required) 20# 3. Both must approve for connection to succeed
Python REPL
Interactive
>>> share(alice)
Agent 'alice_translator' shared on network
 
>>> translator = need("translate to Spanish", trust="strict")
Evaluating agent: alice_translator
✓ Verified agent credentials
✓ Passed capability test
✓ Response time: 245ms
 
>>> translator.input("Hello world")
"Hola mundo"

Both trust requirements must be satisfied for interaction!

Progressive Trust Building

Trust grows through successful interactions:

1
First Encounter
Agent is tested before use
2
Successful Interactions
Agent automatically added to verified list
3
Future Encounters
Skip testing, already verified

Environment Defaults

Development
localhost, Jupyter → open
Testing
test_*.py files → tested
Production
Default → strict

Security Best Practices

  1. 1.Always use strict in production
  2. 2.Test sensitive operations
  3. 3.Whitelist critical services
  4. 4.Monitor trust decisions
  5. 5.Regular audits

Common Patterns

Mixed Trust
scraper = need("scrape", trust="open")
analyzer = need("analyze", trust="tested")
payment = need("payment", trust="strict")