Cryptographic identity + ML behavioral trust scoring for AI agent networks
Project description
TrustAgent Python SDK
Cryptographic identity + behavioral ML trust verification for AI agents.
pip install trustagent
Quick Start
from trustagent import TrustAgent
# Initialize with your API key
ta = TrustAgent(api_key="your_api_key_here")
# Register an agent
agent = ta.register("PaymentBot", description="Handles payment processing")
print(agent) # ✅ PaymentBot | Trust: 100.0 | Status: active
# Log behaviors — ML scores each action in real time
result = agent.log("process_payment", payload={"amount": 100, "currency": "USD"})
print(f"Trust score: {result.trust_score}")
print(f"Anomaly detected: {result.is_anomalous}")
# Check if safe to proceed
if result.is_safe:
proceed_with_action()
else:
alert_security_team()
Use Cases
Multi-Agent Trust Verification
from trustagent import TrustAgent, InsufficientTrustError
ta = TrustAgent(api_key="your_api_key")
# Agent A wants to send a task to Agent B
agent_a = ta.get("agent-a-id")
agent_b = ta.get("agent-b-id")
# Before Agent B acts on Agent A's request, verify trust
agent_a.refresh()
if not agent_a.is_trusted:
raise InsufficientTrustError(f"{agent_a.name} trust too low: {agent_a.trust_score:.1f}")
# Log the interaction
result = agent_b.log("execute_task_from_agent_a", payload={"task": "send_invoice"})
if result.is_anomalous:
print(f"⚠ Anomaly detected! Trust dropped to {result.trust_score:.1f}")
LangChain Integration
from langchain.agents import Tool
from trustagent import TrustAgent
ta = TrustAgent(api_key="your_api_key")
agent = ta.register("LangChainAgent")
def trusted_tool_call(action: str) -> str:
result = agent.log(action)
if not result.is_safe:
return f"Action blocked: trust score {result.trust_score:.1f}"
# proceed with tool call
return execute_tool(action)
tool = Tool(name="TrustedAction", func=trusted_tool_call, description="Execute with trust verification")
CrewAI Integration
from crewai import Agent as CrewAgent
from trustagent import TrustAgent
ta = TrustAgent(api_key="your_api_key")
trust_agent = ta.register("CrewAIResearcher")
class TrustedCrewAgent(CrewAgent):
def execute_task(self, task):
result = trust_agent.log("execute_task", payload={"task": str(task)})
if result.is_anomalous:
raise Exception(f"Trust violation detected: {result.trust_score:.1f}")
return super().execute_task(task)
AutoGen Integration
import autogen
from trustagent import TrustAgent
ta = TrustAgent(api_key="your_api_key")
trust_agent = ta.register("AutoGenAssistant")
class TrustedAssistantAgent(autogen.AssistantAgent):
def generate_reply(self, messages, sender):
trust_agent.log("generate_reply", payload={"message_count": len(messages)})
return super().generate_reply(messages, sender)
API Reference
TrustAgent(api_key, base_url=None)
Main client class.
| Method | Description |
|---|---|
ta.register(name, description) |
Register a new agent |
ta.get(agent_id) |
Get existing agent by ID |
ta.list() |
List all agents |
ta.verify_interaction(sender_id, receiver_id, message, signature) |
Verify agent-to-agent message |
ta.health() |
Check API connectivity |
Agent
| Method/Property | Description |
|---|---|
agent.log(action_type, payload) |
Log behavior, get trust score |
agent.audit_trail(limit) |
Get behavior history |
agent.refresh() |
Update agent data from API |
agent.sign(message) |
Sign message with agent's private key |
agent.is_trusted |
True if trust score ≥ 80 |
agent.is_suspended |
True if agent is suspended |
agent.trust_score |
Current trust score (0-100) |
agent.status |
active / warning / breach / suspended |
BehaviorResult
| Property | Description |
|---|---|
result.trust_score |
Updated trust score after action |
result.is_anomalous |
True if ML flagged as anomaly |
result.is_safe |
True if normal and trust ≥ 50 |
result.anomaly_score |
Raw anomaly score from ML model |
Exceptions
from trustagent import (
TrustAgentError, # Base exception
AuthenticationError, # Invalid API key
AgentNotFoundError, # Agent ID not found
AnomalyDetectedError, # Behavior flagged as anomaly
InsufficientTrustError, # Trust score too low
)
Get Your API Key
Sign up free at https://trustagent-production.up.railway.app
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cllova-1.0.0.tar.gz
(7.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cllova-1.0.0.tar.gz.
File metadata
- Download URL: cllova-1.0.0.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62c1df267a0b5ed6297a4c4263f660193c961c5a8e37d0210225ec1d2d2e5d38
|
|
| MD5 |
e8c1d812088439dedabce6893a97fa45
|
|
| BLAKE2b-256 |
a200348d2cc61890461d2c65d46edae5f9014fddab6cd2a5bc119a6985724da0
|
File details
Details for the file cllova-1.0.0-py3-none-any.whl.
File metadata
- Download URL: cllova-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d011c2f268da3986649dc760c2e3a72655b8259577ae98f50166f26c8345f149
|
|
| MD5 |
86cd226f4a93fa60bfae98a62754114f
|
|
| BLAKE2b-256 |
9e6e0e945a2edd33a673d9d88bf141c72631ac23c3880bbf175751ab35a8b9d2
|