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)
strictVerified agents only (production)

2. Trust Rules (Dict)

Fine-grained control with custom rules:

custom_trust.py
1trust_rules = { 2 "allow": ["agent1", "agent2"], # Whitelist 3 "deny": ["untrusted_agent"], # Blacklist 4 "require_auth": True, # Authentication 5 "test_timeout": 30, # Test duration 6 "max_interactions": 100 # Rate limiting 7} 8 9agent = Agent("secure", trust=trust_rules)

3. Trust Functions

Dynamic trust evaluation with custom logic:

dynamic_trust.py
1def custom_trust(agent_name: str, context: dict) -> bool: 2 """Evaluate trust based on custom logic""" 3 if context.get("environment") == "production": 4 return agent_name in VERIFIED_AGENTS 5 return True # Open in development 6 7agent = Agent("dynamic", trust=custom_trust)

Bidirectional Trust

Trust works both ways in ConnectOnion:

Outbound Trust

Who I trust to use

need("service", trust="...")

Inbound Trust

Who can use me

Agent(..., trust="...")

Choose Your Trust Level

Development?

Use open

Testing/Staging?

Use tested

Production?

Use strict

Common Patterns

  • Progressive trust elevation
  • Environment-based trust
  • Mutual authentication
  • Rate limiting & quotas

Security Note

Always use strict trust in production environments to prevent unauthorized access.