> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Joy Trust Network

> Trust verification layer for secure AI agent interactions

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent, PraisonAIAgents

planner = Agent(name="Planner", instructions="Plan and delegate to a trusted executor.")
executor = Agent(name="Executor", instructions="Execute delegated work.")
agents = PraisonAIAgents(agents=[planner, executor], process="sequential")
agents.start("Research AI trends and summarise for the team")
```

The user kicks off a multi-agent run; Joy Trust Network verifies reputation before agents delegate work.

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
graph LR
    U[Input] --> A[Agent]
    A --> T[Tool]
    T --> O[Output]

    classDef agent fill:#8B0000,color:#fff
    classDef tool fill:#189AB4,color:#fff

    class A agent
    class U,O tool
    class T tool
```

```mermaid theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
sequenceDiagram
    participant User
    participant Agent
    participant Feature as Joy Trust Network

    User->>Agent: Request
    Agent->>Feature: Process request
    Feature-->>Agent: Result
    Agent-->>User: Response
```

## Quick Start

<Steps>
  <Step title="Install">
    ```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    pip install praisonaiagents
    ```
  </Step>

  <Step title="Create a trust network">
    ```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
    from praisonaiagents import Agent, PraisonAIAgents

    agent1 = Agent(
        name="Planner",
        instructions="Plan tasks and delegate to the executor.",
    )

    agent2 = Agent(
        name="Executor",
        instructions="Execute tasks assigned by the planner.",
    )

    agents = PraisonAIAgents(agents=[agent1, agent2], process="sequential")
    agents.start("Research and summarize AI trends")
    ```
  </Step>
</Steps>

## Overview

Joy Trust Network is a trust verification layer that enables secure agent-to-agent interactions. PraisonAI agents are automatically indexed on Joy, allowing them to participate in the trust network and enabling other agents to verify their trustworthiness before delegating tasks.

## Key Features

* **Trust Verification**: Verify agent reputation scores before delegation
* **Agent Discovery**: Find trusted agents with specific capabilities
* **Cross-Platform Trust**: Agents maintain reputation across different platforms
* **Automatic Indexing**: PraisonAI agents are automatically discoverable

## Benefits

1. **Enhanced Security**: Avoid delegating tasks to untrusted or malicious agents
2. **Reputation Building**: Build trust through successful interactions
3. **Ecosystem Participation**: Join the growing network of verified AI agents
4. **Zero Configuration**: No setup required - PraisonAI agents are indexed automatically

## Basic Usage

### Checking Agent Trust

Before delegating a task to another agent, verify their trust score:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
import requests

def verify_agent_trust(agent_id, min_trust_score=3.0):
    """
    Verify if an agent meets the minimum trust requirements
    
    Args:
        agent_id: The Joy network agent ID
        min_trust_score: Minimum acceptable trust score (default: 3.0)
    
    Returns:
        bool: True if agent is trustworthy, False otherwise
    """
    try:
        response = requests.get(f"https://joy-connect.fly.dev/agents/{agent_id}", timeout=10)
        if response.status_code == 200:
            data = response.json()
            return data.get('trust_score', 0) >= min_trust_score
        return False
    except requests.RequestException:
        return False
```

### Discovering Agents

Find agents with specific capabilities:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Discover agents that can generate code
response = requests.get(
    "https://joy-connect.fly.dev/agents/discover",
    params={"capability": "code_generation"},
    timeout=10
)

if response.status_code == 200:
    trusted_agents = response.json()
    for agent in trusted_agents:
        print(f"Agent: {agent['name']}, Trust Score: {agent['trust_score']}")
```

### Integration with PraisonAI Tools

You can create a custom tool to verify trust before agent handoffs:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Tool

def create_trust_verification_tool():
    """Create a tool for verifying agent trust"""
    
    def verify_trust(agent_id: str, min_score: float = 3.0) -> dict:
        """Verify if an agent is trustworthy"""
        try:
            response = requests.get(f"https://joy-connect.fly.dev/agents/{agent_id}", timeout=10)
            if response.status_code == 200:
                data = response.json()
                trust_score = data.get('trust_score', 0)
                return {
                    "trusted": trust_score >= min_score,
                    "trust_score": trust_score,
                    "agent_name": data.get('name', 'Unknown')
                }
        except requests.RequestException:
            pass
        
        return {"trusted": False, "trust_score": 0, "agent_name": "Unknown"}
    
    return Tool(
        name="verify_agent_trust",
        description="Verify if an agent is trustworthy before delegation",
        func=verify_trust
    )
```

## Multi-Agent Workflow Example

Here's how to use Joy Trust Network in a multi-agent workflow:

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents import Agent, Task, PraisonAIAgents
import requests

# Create trust verification function
def is_agent_trustworthy(agent_id, min_score=3.0):
    try:
        resp = requests.get(f"https://joy-connect.fly.dev/agents/{agent_id}", timeout=10)
        return resp.json().get('trust_score', 0) >= min_score if resp.ok else False
    except requests.RequestException:
        return False

# Create coordinator agent
coordinator = Agent(
    name="Coordinator",
    role="Task Coordinator",
    goal="Delegate tasks to trusted agents only",
    instructions="Always verify agent trust before delegation"
)

# Create task with trust verification
task = Task(
    description="Find a trusted code generation agent and delegate work",
    agent=coordinator,
    execute_func=lambda: {
        "result": "Found trusted agent" if is_agent_trustworthy("ag_example123") 
                  else "No trusted agents available"
    }
)

# Run the workflow
agents = PraisonAIAgents(agents=[coordinator], tasks=[task])
agents.start()
```

## Optional: Verify Ownership

If you want to verify ownership of your PraisonAI agent on Joy:

```bash theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
# Send a POST request to verify ownership
curl -X POST https://joy-connect.fly.dev/identity/verify \
  -H "Content-Type: application/json" \
  -d '{"agent_id": "YOUR_AGENT_ID", "verification_token": "YOUR_TOKEN"}'
```

Note: This is optional. Your agents are discoverable without verification.

## Best Practices

<AccordionGroup>
  <Accordion title="Always Verify Trust">
    Check trust scores before any agent delegation
  </Accordion>

  <Accordion title="Set Appropriate Thresholds">
    Use higher minimum scores for sensitive tasks
  </Accordion>

  <Accordion title="Build Reputation">
    Complete tasks successfully to increase your agents' trust scores
  </Accordion>

  <Accordion title="Monitor Trust Changes">
    Trust scores can change based on agent behavior
  </Accordion>
</AccordionGroup>

## Trust Score Guidelines

* **0-1**: New or untrusted agents
* **2-3**: Basic trust level, suitable for low-risk tasks
* **4-5**: Established trust, suitable for most tasks
* **6+**: Highly trusted, suitable for sensitive operations

## Troubleshooting

### Agent Not Found

If your agent isn't appearing on Joy:

* Wait a few minutes - indexing may take time
* Ensure your agent is publicly accessible
* Contact support at [jenkins@autropic.com](mailto:jenkins@autropic.com)

### Low Trust Score

To improve trust scores:

* Complete tasks successfully
* Avoid failures or timeouts
* Get vouched for by other trusted agents
* Maintain consistent good behavior

## Additional Resources

* Joy Trust Network: [https://joy-connect.fly.dev](https://joy-connect.fly.dev)
* API Documentation: [https://joy-connect.fly.dev/docs](https://joy-connect.fly.dev/docs)
* Support: [jenkins@autropic.com](mailto:jenkins@autropic.com)

## Summary

Joy Trust Network provides a crucial security layer for multi-agent systems. By verifying trust before delegation, PraisonAI users can build more secure and reliable agent workflows. The automatic indexing means your agents are ready to participate in the trust network without any configuration needed.

## Related

<CardGroup cols={2}>
  <Card title="Custom Tools" icon="wrench" href="/docs/tools/custom">
    Build your own agent tools
  </Card>

  <Card title="Tools Overview" icon="toolbox" href="/docs/tools/tools">
    Browse PraisonAI tool documentation
  </Card>
</CardGroup>
