|
| 1 | +# Example 07: Multi-Vendor Agent Collaboration |
| 2 | + |
| 3 | +This example demonstrates **trust-gated handoffs** between agents from different AI vendors, orchestrated through AgentMesh's governance layer. |
| 4 | + |
| 5 | +## Scenario |
| 6 | + |
| 7 | +A customer support pipeline where three vendor-specific agents collaborate: |
| 8 | + |
| 9 | +``` |
| 10 | +Customer Query |
| 11 | + │ |
| 12 | + ▼ |
| 13 | +┌─────────────┐ trust handoff ┌─────────────┐ trust handoff ┌─────────────┐ |
| 14 | +│ Agent A │ ───────────────▶ │ Agent B │ ───────────────▶ │ Agent C │ |
| 15 | +│ (OpenAI) │ │ (Anthropic) │ │ (Google) │ |
| 16 | +│ Customer │ │ Research │ │ Summary │ |
| 17 | +│ Queries │ │ Analysis │ │ Generation │ |
| 18 | +└─────────────┘ └─────────────┘ └─────────────┘ |
| 19 | + │ │ │ |
| 20 | + └──────────────────────────────────┼──────────────────────────────────┘ |
| 21 | + ▼ |
| 22 | + ┌─────────────────────┐ |
| 23 | + │ AgentMesh │ |
| 24 | + │ Trust & Governance │ |
| 25 | + │ ───────────────── │ |
| 26 | + │ • Trust scoring │ |
| 27 | + │ • Audit trail │ |
| 28 | + │ • Policy engine │ |
| 29 | + │ • Capability scope │ |
| 30 | + └─────────────────────┘ |
| 31 | +``` |
| 32 | + |
| 33 | +## What It Shows |
| 34 | + |
| 35 | +| Feature | Description | |
| 36 | +|---|---| |
| 37 | +| **Cross-vendor trust** | Agents from OpenAI, Anthropic, and Google verify each other before handoffs | |
| 38 | +| **Adaptive trust scores** | Trust increases on success, degrades on failure or policy violations | |
| 39 | +| **Trust-gated delegation** | Tasks only route to agents meeting minimum trust thresholds | |
| 40 | +| **Cross-vendor audit trail** | Every handoff logged with vendor, timestamp, trust score, and outcome | |
| 41 | +| **Untrusted agent handling** | Demonstrates graceful degradation when a vendor's trust drops below threshold | |
| 42 | + |
| 43 | +## Running the Demo |
| 44 | + |
| 45 | +No API keys required — all vendor agents are mocked. |
| 46 | + |
| 47 | +```bash |
| 48 | +cd examples/07-multi-vendor-collaboration |
| 49 | +python demo.py |
| 50 | +``` |
| 51 | + |
| 52 | +### Expected Output |
| 53 | + |
| 54 | +The demo runs three rounds: |
| 55 | + |
| 56 | +1. **Round 1** — All agents trusted, full pipeline succeeds |
| 57 | +2. **Round 2** — Agent C (Google) produces poor results, trust degrades |
| 58 | +3. **Round 3** — Agent C's trust drops below threshold, handoff is denied and fallback activates |
| 59 | + |
| 60 | +After all rounds, a full cross-vendor audit trail is printed. |
| 61 | + |
| 62 | +## Key Concepts |
| 63 | + |
| 64 | +### Trust-Gated Handoffs |
| 65 | + |
| 66 | +Before delegating work to another vendor's agent, AgentMesh verifies: |
| 67 | + |
| 68 | +```python |
| 69 | +handshake = TrustHandshake(min_score=700) |
| 70 | +result = handshake.verify_peer(target_agent) |
| 71 | +if result.trusted: |
| 72 | + delegate(task, target_agent) |
| 73 | +else: |
| 74 | + activate_fallback(task) |
| 75 | +``` |
| 76 | + |
| 77 | +### Adaptive Trust Scoring |
| 78 | + |
| 79 | +Trust scores update after every interaction: |
| 80 | + |
| 81 | +- **Success** → trust increases (e.g., +50 points) |
| 82 | +- **Slow response** → minor trust penalty (e.g., −30 points) |
| 83 | +- **Policy violation** → major trust penalty (e.g., −200 points) |
| 84 | +- **Failure** → significant trust penalty (e.g., −300 points) |
| 85 | + |
| 86 | +### Cross-Vendor Audit Trail |
| 87 | + |
| 88 | +Every handoff is recorded with full provenance: |
| 89 | + |
| 90 | +``` |
| 91 | +[2024-01-15 10:00:01] HANDOFF agent-a-openai → agent-b-anthropic | trust: 850 | status: APPROVED |
| 92 | +[2024-01-15 10:00:02] HANDOFF agent-b-anthropic → agent-c-google | trust: 800 | status: APPROVED |
| 93 | +[2024-01-15 10:00:03] TASK_COMPLETE agent-c-google | trust_delta: -150 | reason: poor_quality |
| 94 | +``` |
| 95 | + |
| 96 | +## Extending This Example |
| 97 | + |
| 98 | +- **Add more vendors** — Register additional agents with different vendor tags |
| 99 | +- **Custom trust policies** — Adjust `MIN_TRUST_SCORE` or add vendor-specific thresholds |
| 100 | +- **Real API integration** — Replace mock agents with live OpenAI/Anthropic/Google calls |
| 101 | +- **Persistent audit** — Export the audit trail to a database or SIEM |
| 102 | + |
| 103 | +## Production Considerations |
| 104 | + |
| 105 | +| Concern | Recommendation | |
| 106 | +|---|---| |
| 107 | +| Trust persistence | Store trust scores in a durable backend across restarts | |
| 108 | +| Vendor SLAs | Set per-vendor trust thresholds matching contractual SLAs | |
| 109 | +| Audit compliance | Export audit trail to immutable storage for regulatory review | |
| 110 | +| Fallback chains | Define fallback agents for every vendor in the pipeline | |
| 111 | + |
| 112 | +## Learn More |
| 113 | + |
| 114 | +- [Trust Architecture](../../docs/TRUST.md) |
| 115 | +- [Governance Model](../../GOVERNANCE.md) |
| 116 | +- [AgentMesh Security](../../SECURITY.md) |
0 commit comments