Skip to main content

OpenClaw Integration

Add Treeship verification to OpenClaw agents as a skill.

Setup

pip install treeship-sdk openclaw

Treeship Skill

Create a Treeship skill for OpenClaw:
# skills/treeship_skill.py
from openclaw import Skill
from treeship_sdk import Treeship

ts = Treeship()

class TreeshipSkill(Skill):
    """Skill for creating verifiable attestations of agent actions."""
    
    name = "treeship"
    description = "Create tamper-proof records of actions"
    
    def attest(self, action: str, data: dict = None) -> str:
        """
        Create a verified attestation of an action.
        
        Args:
            action: Description of what the agent did
            data: Optional data to hash (never sent to Treeship)
        
        Returns:
            Verification URL
        """
        attestation = ts.attest(
            agent=self.agent.name,
            action=action,
            inputs_hash=ts.hash(data) if data else None
        )
        return attestation.verify_url

Using the Skill

from openclaw import Agent
from skills.treeship_skill import TreeshipSkill

agent = Agent(
    name="loan-processor",
    skills=[TreeshipSkill()]
)

@agent.on("process_application")
async def handle_application(ctx, application_id: str):
    # Process the loan
    result = await ctx.analyze_creditworthiness(application_id)
    decision = await ctx.make_decision(result)
    
    # Attest the decision
    verify_url = ctx.skills.treeship.attest(
        action=f"Loan decision: {decision.outcome} for #{application_id}",
        data={"application_id": application_id, "decision": decision.outcome}
    )
    
    return {
        "decision": decision,
        "verification": verify_url
    }

Auto-Attest All Actions

For comprehensive verification, wrap all skill executions:
from openclaw import Agent, middleware
from treeship_sdk import Treeship

ts = Treeship()

@middleware
async def attest_all_actions(ctx, next):
    # Run the action
    result = await next()
    
    # Attest it
    ts.attest(
        agent=ctx.agent.name,
        action=f"{ctx.skill_name}.{ctx.method_name}",
        inputs_hash=ts.hash(ctx.inputs)
    )
    
    return result

agent = Agent(
    name="verified-agent",
    middleware=[attest_all_actions]
)

Verification Dashboard

All attestations appear at:
https://treeship.dev/verify/loan-processor
Clients can see every action your agent took, with timestamps and cryptographic proof.

Next Steps