from treeship_sdk import Treeship
class MyAgent:
def __init__(self):
self.ts = Treeship()
def process_request(self, request):
# Do the actual work
result = self._internal_process(request)
# Attest to what happened
try:
attestation = self.ts.attest(
action=f"Processed {request.type} request",
inputs_hash=self.ts.hash(request.to_dict()),
metadata={
"request_id": request.id,
"outcome": result.status
}
)
result.attestation_url = attestation.verify_url
except Exception:
pass # Don't block on attestation failure
return result