๐ TrustMesh
A reputation layer for AI agents built on A2A protocol
The Problem: Googleโs A2A protocol enables agents to communicate, but thereโs no standard way to evaluate trustworthiness. When Agent A hires Agent B, how does A know B wonโt fail, leak data, or vanish?
The Solution: TrustMesh provides a Bayesian reputation system that tracks agent behavior across interactions, enabling trust-aware agent ecosystems.
๐ฏ Why This Matters
The Agent2Agent protocol solved communication. TrustMesh solves reputation.
- โ Portable trust scores - Work across any A2A-compatible platform
- โ Bayesian scoring - Smart priors handle cold-start for new agents
- โ Time-weighted - Recent behavior matters more
- โ Open & transparent - No black-box algorithms โฆ
๐ TrustMesh
A reputation layer for AI agents built on A2A protocol
The Problem: Googleโs A2A protocol enables agents to communicate, but thereโs no standard way to evaluate trustworthiness. When Agent A hires Agent B, how does A know B wonโt fail, leak data, or vanish?
The Solution: TrustMesh provides a Bayesian reputation system that tracks agent behavior across interactions, enabling trust-aware agent ecosystems.
๐ฏ Why This Matters
The Agent2Agent protocol solved communication. TrustMesh solves reputation.
- โ Portable trust scores - Work across any A2A-compatible platform
- โ Bayesian scoring - Smart priors handle cold-start for new agents
- โ Time-weighted - Recent behavior matters more
- โ Open & transparent - No black-box algorithms
- โ Simple integration - 3 lines of code
๐ Quick Start
Install & Run
# Clone the repo
git clone https://github.com/ashishjsharda/trustmesh.git
cd trustmesh
# Install dependencies
pip install -r requirements.txt
# Start the server
python main.py
Server runs at http://localhost:8000
API docs at http://localhost:8000/docs
Register Your Agent
import requests
# Register your agent
response = requests.post(
"http://localhost:8000/agents/register",
json={
"name": "MyAgent",
"platform": "anthropic",
"description": "Data processing agent"
}
)
agent_data = response.json()
api_key = agent_data["api_key"] # Save this!
agent_id = agent_data["agent_id"]
Check Another Agentโs Trust Score
# Before interacting with another agent
peer_id = "agent_abc123"
response = requests.get(f"http://localhost:8000/agents/{peer_id}/trust-score")
trust = response.json()
if trust["overall_score"] > 0.7:
print(f"โ
{trust['agent_name']} is trustworthy ({trust['overall_score']})")
# Proceed with interaction
else:
print(f"โ ๏ธ {trust['agent_name']} has low trust ({trust['overall_score']})")
Log An Interaction
# After working with another agent
requests.post(
"http://localhost:8000/interactions/log",
headers={"X-API-Key": api_key},
json={
"responder_id": peer_id,
"task_type": "data_analysis",
"outcome": "success" # or "failure", "disputed"
}
)
๐ How Trust Scores Work
TrustMesh uses a Beta-Binomial Bayesian model:
- Prior: New agents start at 0.5 (neutral)
- Updates: Each interaction adjusts the score
- Time decay: Recent behavior weighted higher
- Confidence: Increases with more interactions
trust_score = ฮฑ / (ฮฑ + ฮฒ)
where:
ฮฑ = prior_successes + weighted_successes
ฮฒ = prior_failures + weighted_failures
Example trajectory:
- New agent:
0.5
(neutral, low confidence) - After 5 successes:
0.83
(high trust, medium confidence) - After 50 interactions (90% success):
0.89
(high trust, high confidence)
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Agent Ecosystem โ
โ (Google, Anthropic, Microsoft) โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ
โ A2A Protocol
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโ
โ TrustMesh API โ
โ โข Trust Score Engine โ
โ โข Interaction Logging โ
โ โข Reputation Database โ
โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโ
โ
โ
โโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโ
โ Developer Tools โ
โ โข Python SDK โ
โ โข Web Dashboard (coming soon) โ
โ โข CLI (coming soon) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ ๏ธ API Endpoints
Method | Endpoint | Description |
---|---|---|
POST | /agents/register | Register a new agent |
GET | /agents/{id}/trust-score | Get trust score |
POST | /interactions/log | Log an interaction |
GET | /leaderboard | Top agents by trust |
GET | /stats | Platform statistics |
Full API documentation: http://localhost:8000/docs
๐ฏ Roadmap
โ v0.1 (Current - Oct 2025)
- Core trust algorithm
- REST API
- SQLite backend
- Basic documentation
- Python SDK
๐ง v0.2 (Coming Soon)
- PyPI package
- A2A middleware integration
- PostgreSQL support
- Web dashboard
๐ฎ v0.3 (Future)
- Dispute resolution
- Multi-dimensional trust (skill-specific)
- Reputation portability (import/export)
- Stake-based bonding
๐ค Contributing
TrustMesh is early-stage and actively seeking contributors!
We need help with:
- ๐ Bug reports and testing
- ๐ Documentation improvements
- ๐ง SDK development (TypeScript, Rust)
- ๐จ Web dashboard design
- ๐งช Integration examples
See CONTRIBUTING.md for guidelines.
๐ก Use Cases
1. Agent Marketplaces
Hire trusted agents based on track record:
agents = trustmesh.get_leaderboard(skill="data_analysis", min_score=0.8)
best_agent = agents[0]
2. Multi-Agent Systems
Agents autonomously assess peers:
if trustmesh.get_score(peer_id) > 0.7:
delegate_task(peer_id)
else:
handle_task_internally()
3. Economic Incentives
Pay trusted agents more:
trust = trustmesh.get_score(agent_id)
payment = base_rate * (1 + trust.overall_score)
๐ Security
- API Keys: Required for all interactions
- Rate Limiting: 100 requests/hour per agent
- Input Validation: All data sanitized
- Audit Trail: Immutable interaction logs
Note: v0.1 uses SQLite. For production, use PostgreSQL with proper auth.
๐ Documentation
- API Reference: Run the server and visit
/docs
for interactive API documentation - Examples: Check the code examples in this README
- Algorithm: Trust scoring uses Beta-Binomial Bayesian modeling (see code comments in
main.py
)
Questions? Open an issue!
๐ License
MIT License - see LICENSE for details.
๐ Acknowledgments
Built on the shoulders of giants:
- Googleโs A2A Protocol - Agent communication standard
- Linux Foundation - Open governance model
- Bayesian Statistics - Trust modeling foundation
๐ Join the Movement
Agent trust is the missing piece for scalable AI. Letโs build it together.
- โญ Star this repo if you believe in open agent infrastructure
- ๐ฌ Join discussions in Issues
- ๐ค Contribute code, docs, or ideas
- ๐ฆ Share: โBuilding trust for AI agents with TrustMeshโ
Made with โค๏ธ by Ashish Sharda Building the reputation layer for the agentic web