Skip to main content

Nanobot Integration

Add Treeship verification to Nanobot agents. Supports both Nanobot (HKUDS) and Nanobot.ai.

Nanobot (HKUDS)

Nanobot HKUDS uses a Python skills system. Add Treeship as a skill that calls the sidecar:

Python Skill Setup

# ~/.nanobot/skills/treeship.py
import httpx
import hashlib
import json

async def attest(action: str, inputs: dict = None) -> str | None:
    """
    Attest a key agent action. Returns verification URL or None.
    NEVER raises — attestation failure never blocks agent work.
    """
    payload = {"action": action}
    if inputs:
        payload["inputs"] = {
            "hash": hashlib.sha256(
                json.dumps(inputs, sort_keys=True).encode()
            ).hexdigest()
        }
    try:
        async with httpx.AsyncClient(timeout=10.0) as c:
            r = await c.post("http://treeship-sidecar:2019/attest", json=payload)
            if r.status_code == 200:
                return r.json().get("url")
    except Exception:
        pass
    return None

Config

{
  "skills": ["treeship"],
  "...": "your other config"
}

Nanobot.ai (MCP-Native)

Nanobot.ai agents are defined as markdown files. Treeship integrates via MCP:

MCP Config

# mcp-servers.yaml
treeship:
  url: http://treeship-sidecar:2019/mcp

Agent Definition

# agents/my-agent.md
---
name: My Agent
model: claude-sonnet-4-20250514
mcpServers:
  - treeship
---
You are a helpful assistant. Use treeship_attest to create tamper-proof 
records at key decision points: data reads, consequential decisions, 
external tool calls, and final outputs.

Docker Compose (Both)

services:
  nanobot:
    image: your-nanobot-image
    depends_on:
      treeship-sidecar:
        condition: service_healthy
    networks: [internal]

  treeship-sidecar:
    image: zerker/treeship-sidecar:latest
    environment:
      - TREESHIP_API_KEY=${TREESHIP_API_KEY}
      - TREESHIP_AGENT=my-nanobot-agent
      - TREESHIP_HASH_ONLY=true
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:2019/health"]
      interval: 10s
    networks: [internal]

networks:
  internal:

Using Treeship Tools

Once configured, your agent can attest actions:
Agent: I'll process this loan application and create a verification record.

<tool_use>
  <name>treeship_attest</name>
  <input>
    <action>Approved loan application #12345</action>
    <data>{"application_id": "12345", "amount": 50000, "decision": "approved"}</data>
  </input>
</tool_use>

The loan has been approved. Verification: https://treeship.dev/verify/my-nanobot-agent/abc123

Verification Page

Every action creates a permanent record at:
https://treeship.dev/verify/my-nanobot-agent

MCP Server Details

The Treeship sidecar exposes these MCP tools:
ToolDescription
treeship_attestCreate a tamper-proof attestation
treeship_verifyVerify an existing attestation

Next Steps