# 2823sanskar/agenttrust architecture

> Architecture diagram of the GitHub repository 2823sanskar/agenttrust, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/2823sanskar/agenttrust
- Repository: https://github.com/2823sanskar/agenttrust

## Overview

AgentTrust lets developers register AI agents, submit tasks, inspect execution evidence, and share verifiable run proofs. The backend routes executions to supported providers, records telemetry, hashes the evidence, attempts Stellar anchoring, and recalculates trust; users can then inspect runs and verify proofs. The graph covers the sampled API and execution path plus major README-documented capabilities. Some provider, UI, and verification details are represented only at their source-file level because those implementations were not excerpted.

Main entry points: [`backend/app/services/execution_service.py`](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/execution_service.py) (Run orchestration), [`backend/app/main.py`](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/api/verify.py`](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/verify.py) (Verification API), [`frontend/lib/api.ts`](https://github.com/2823sanskar/agenttrust/blob/main/frontend/lib/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["User application"]
  node_web["AgentTrust web app<br/>[page.tsx]"]
  node_web_api["API client<br/>[api.ts]"]
  node_agent_ui["Agent discovery and registration<br/>[page.tsx]"]
  node_execute_ui["Task execution<br/>[page.tsx]"]
  node_run_ui["Run details<br/>[page.tsx]"]
  node_verify_ui["Public verification<br/>[page.tsx]"]
end

subgraph group_api["Backend API"]
  node_auth_api["Authentication and wallet<br/>[auth.py]"]
  node_agent_api["Agent management API<br/>[agents.py]"]
  node_exec_api["Execution API<br/>[executions.py]"]
  node_verify_api["Verification API<br/>[verify.py]"]
  node_trust_api["Trust API<br/>[trust.py]"]
  node_sandbox_api["Sandbox health API<br/>[sandbox.py]"]
  node_app_entry["FastAPI application<br/>[main.py]"]
  node_auth_service["JWT and account service<br/>[auth_service.py]"]
end

subgraph group_execution["Execution and reputation"]
  node_agent_service["Agent lifecycle<br/>[agent_service.py]"]
  node_execution_service["Run orchestration"]
  node_ai_provider["OpenRouter provider<br/>[ai_provider.py]"]
  node_browser_runner["Browser runner<br/>[browser_agent.py]"]
  node_docker_runner["Docker runner<br/>[docker_sandbox.py]"]
  node_vm_runner["Remote worker runner<br/>[vm_sandbox.py]"]
  node_sandbox_worker["Sandbox worker<br/>[worker.py]"]
  node_trust_service["Trust scoring<br/>[trust_service.py]"]
end

subgraph group_data["Persistence and proof"]
  node_hashing["Evidence fingerprinting<br/>[hashing.py]"]
  node_stellar["Stellar anchoring and lookup<br/>[stellar.py]"]
  node_database[("SQLAlchemy session layer<br/>[database.py]")]
  node_agent_model["Agent records<br/>[agent.py]"]
  node_run_model["Run telemetry<br/>[run.py]"]
  node_user_model["User and wallet records<br/>[user.py]"]
  node_trust_model["Trust score records<br/>[trust_score.py]"]
end

node_developer(("Developer or user"))

node_developer -->|"uses"| node_web
node_web -->|"requests data"| node_web_api
node_web_api -.->|"calls API"| node_agent_api
node_web_api -.->|"submits tasks"| node_exec_api
node_web_api -.->|"requests proof"| node_verify_api
node_app_entry -->|"registers router"| node_auth_api
node_app_entry -->|"registers router"| node_agent_api
node_app_entry -->|"registers router"| node_exec_api
node_app_entry -->|"registers router"| node_trust_api
node_app_entry -->|"registers router"| node_verify_api
node_app_entry -->|"registers router"| node_sandbox_api
node_auth_api -->|"delegates auth"| node_auth_service
node_agent_api -->|"delegates management"| node_agent_service
node_exec_api -->|"starts and reads runs"| node_execution_service
node_verify_api -->|"verifies run"| node_execution_service
node_agent_service -->|"creates and queries"| node_agent_model
node_agent_service -->|"creates score"| node_trust_model
node_execution_service -->|"executes provider"| node_ai_provider
node_execution_service -->|"runs browser task"| node_browser_runner
node_execution_service -->|"runs local container"| node_docker_runner
node_execution_service -->|"runs remote container"| node_vm_runner
node_vm_runner -.->|"dispatches task"| node_sandbox_worker
node_execution_service -->|"hashes evidence"| node_hashing
node_execution_service -->|"anchors hash"| node_stellar
node_execution_service -->|"recalculates score"| node_trust_service
node_execution_service -->|"persists telemetry"| node_run_model
node_execution_service -->|"loads agent"| node_agent_model
node_execution_service -->|"loads user"| node_user_model
node_trust_service -->|"reads executions"| node_run_model
node_trust_service -->|"updates score"| node_trust_model
node_verify_api -.->|"serves run data"| node_run_ui
node_verify_ui -.->|"checks proof"| node_verify_api
node_database -->|"provides ORM base"| node_agent_model
node_database -->|"provides ORM base"| node_run_model
node_database -->|"provides ORM base"| node_user_model
node_auth_service -->|"reads and writes users"| node_user_model

click node_web "https://github.com/2823sanskar/agenttrust/blob/main/frontend/app/(landing)/page.tsx"
click node_web_api "https://github.com/2823sanskar/agenttrust/blob/main/frontend/lib/api.ts"
click node_agent_ui "https://github.com/2823sanskar/agenttrust/blob/main/frontend/app/agents/page.tsx"
click node_execute_ui "https://github.com/2823sanskar/agenttrust/blob/main/frontend/app/agents/%5Bid%5D/execute/page.tsx"
click node_run_ui "https://github.com/2823sanskar/agenttrust/blob/main/frontend/app/runs/%5Bid%5D/page.tsx"
click node_verify_ui "https://github.com/2823sanskar/agenttrust/blob/main/frontend/app/verify/%5BrunId%5D/page.tsx"
click node_auth_api "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/auth.py"
click node_agent_api "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/agents.py"
click node_exec_api "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/executions.py"
click node_verify_api "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/verify.py"
click node_trust_api "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/trust.py"
click node_sandbox_api "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/sandbox.py"
click node_app_entry "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/main.py"
click node_agent_service "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/agent_service.py"
click node_execution_service "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/execution_service.py"
click node_ai_provider "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/ai_provider.py"
click node_browser_runner "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/browser_agent.py"
click node_docker_runner "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/docker_sandbox.py"
click node_vm_runner "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/vm_sandbox.py"
click node_sandbox_worker "https://github.com/2823sanskar/agenttrust/blob/main/sandbox-worker/worker.py"
click node_trust_service "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/trust_service.py"
click node_hashing "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/utils/hashing.py"
click node_stellar "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/blockchain/stellar.py"
click node_database "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/database.py"
click node_agent_model "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/models/agent.py"
click node_run_model "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/models/run.py"
click node_user_model "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/models/user.py"
click node_trust_model "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/models/trust_score.py"
click node_auth_service "https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/auth_service.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web,node_web_api,node_agent_ui,node_execute_ui,node_run_ui,node_verify_ui,node_developer toneBlue
class node_auth_api,node_agent_api,node_exec_api,node_verify_api,node_trust_api,node_sandbox_api,node_app_entry,node_auth_service toneAmber
class node_agent_service,node_execution_service,node_ai_provider,node_browser_runner,node_docker_runner,node_vm_runner,node_sandbox_worker,node_trust_service toneMint
class node_hashing,node_stellar,node_database,node_agent_model,node_run_model,node_user_model,node_trust_model toneRose
```

## Components

### User application

- [AgentTrust web app](https://github.com/2823sanskar/agenttrust/blob/main/frontend/app/(landing)/page.tsx): `frontend/app/(landing)/page.tsx`
- [API client](https://github.com/2823sanskar/agenttrust/blob/main/frontend/lib/api.ts): `frontend/lib/api.ts`
- [Agent discovery and registration](https://github.com/2823sanskar/agenttrust/blob/main/frontend/app/agents/page.tsx): `frontend/app/agents/page.tsx`
- [Task execution](https://github.com/2823sanskar/agenttrust/blob/main/frontend/app/agents/%5Bid%5D/execute/page.tsx): `frontend/app/agents/[id]/execute/page.tsx`
- [Run details](https://github.com/2823sanskar/agenttrust/blob/main/frontend/app/runs/%5Bid%5D/page.tsx): `frontend/app/runs/[id]/page.tsx`
- [Public verification](https://github.com/2823sanskar/agenttrust/blob/main/frontend/app/verify/%5BrunId%5D/page.tsx): `frontend/app/verify/[runId]/page.tsx`

### Backend API

- [Authentication and wallet](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/auth.py): `backend/app/api/auth.py`
- [Agent management API](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/agents.py): `backend/app/api/agents.py`
- [Execution API](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/executions.py): `backend/app/api/executions.py`
- [Verification API](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/verify.py): `backend/app/api/verify.py`
- [Trust API](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/trust.py): `backend/app/api/trust.py`
- [Sandbox health API](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/api/sandbox.py): `backend/app/api/sandbox.py`
- [FastAPI application](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/main.py): `backend/app/main.py`
- [JWT and account service](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`

### Execution and reputation

- [Agent lifecycle](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/agent_service.py): `backend/app/services/agent_service.py`
- [Run orchestration](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/execution_service.py): `backend/app/services/execution_service.py`
- [OpenRouter provider](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/ai_provider.py): `backend/app/services/ai_provider.py`
- [Browser runner](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/browser_agent.py): `backend/app/services/browser_agent.py`
- [Docker runner](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/docker_sandbox.py): `backend/app/services/docker_sandbox.py`
- [Remote worker runner](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/vm_sandbox.py): `backend/app/services/vm_sandbox.py`
- [Sandbox worker](https://github.com/2823sanskar/agenttrust/blob/main/sandbox-worker/worker.py): `sandbox-worker/worker.py`
- [Trust scoring](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/services/trust_service.py): `backend/app/services/trust_service.py`

### Persistence and proof

- [Evidence fingerprinting](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/utils/hashing.py): `backend/app/utils/hashing.py`
- [Stellar anchoring and lookup](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/blockchain/stellar.py): `backend/app/blockchain/stellar.py`
- [SQLAlchemy session layer](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/database.py): `backend/app/database.py`
- [Agent records](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/models/agent.py): `backend/app/models/agent.py`
- [Run telemetry](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/models/run.py): `backend/app/models/run.py`
- [User and wallet records](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [Trust score records](https://github.com/2823sanskar/agenttrust/blob/main/backend/app/models/trust_score.py): `backend/app/models/trust_score.py`

### Other components

- **Developer or user**

## Connections

- Developer or user → AgentTrust web app: uses (evidence: `README.md`)
- AgentTrust web app → API client: requests data (evidence: `README.md`)
- API client → Agent management API: calls API
- API client → Execution API: submits tasks
- API client → Verification API: requests proof
- FastAPI application → Authentication and wallet: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Agent management API: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Execution API: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Trust API: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Verification API: registers router (evidence: `backend/app/main.py`)
- FastAPI application → Sandbox health API: registers router (evidence: `backend/app/main.py`)
- Authentication and wallet → JWT and account service: delegates auth (evidence: `backend/app/api/auth.py`)
- Agent management API → Agent lifecycle: delegates management (evidence: `backend/app/api/agents.py`)
- Execution API → Run orchestration: starts and reads runs (evidence: `backend/app/api/executions.py`)
- Verification API → Run orchestration: verifies run (evidence: `backend/app/api/verify.py`)
- Agent lifecycle → Agent records: creates and queries (evidence: `backend/app/services/agent_service.py`)
- Agent lifecycle → Trust score records: creates score (evidence: `backend/app/services/agent_service.py`)
- Run orchestration → OpenRouter provider: executes provider (evidence: `backend/app/services/execution_service.py`)
- Run orchestration → Browser runner: runs browser task (evidence: `backend/app/services/execution_service.py`)
- Run orchestration → Docker runner: runs local container (evidence: `backend/app/services/execution_service.py`)
- Run orchestration → Remote worker runner: runs remote container (evidence: `backend/app/services/execution_service.py`)
- Remote worker runner → Sandbox worker: dispatches task
- Run orchestration → Evidence fingerprinting: hashes evidence (evidence: `backend/app/services/execution_service.py`)
- Run orchestration → Stellar anchoring and lookup: anchors hash (evidence: `backend/app/services/execution_service.py`)
- Run orchestration → Trust scoring: recalculates score (evidence: `backend/app/services/execution_service.py`)
- Run orchestration → Run telemetry: persists telemetry (evidence: `backend/app/services/execution_service.py`)
- Run orchestration → Agent records: loads agent (evidence: `backend/app/services/execution_service.py`)
- Run orchestration → User and wallet records: loads user (evidence: `backend/app/services/execution_service.py`)
- Trust scoring → Run telemetry: reads executions (evidence: `backend/app/services/trust_service.py`)
- Trust scoring → Trust score records: updates score (evidence: `backend/app/services/trust_service.py`)
- Verification API → Run details: serves run data
- Public verification → Verification API: checks proof
- SQLAlchemy session layer → Agent records: provides ORM base (evidence: `backend/app/models/agent.py`)
- SQLAlchemy session layer → Run telemetry: provides ORM base (evidence: `backend/app/models/run.py`)
- SQLAlchemy session layer → User and wallet records: provides ORM base (evidence: `backend/app/models/user.py`)
- JWT and account service → User and wallet records: reads and writes users (evidence: `backend/app/services/auth_service.py`)
