Skip to main content

Developer docs

Seal your first agent action.

Add RANKIGI beside an agent, submit one witnessed event, and verify the resulting chain outside RANKIGI.

terminal
npm install @rankigi/sdk

01

Install the SDK

Add RANKIGI to the agent runtime.

02

Wrap one action

Inputs and outputs are hashed, signed, and chained.

03

Export the proof

Download the chain bundle for review.

04

Verify locally

Recompute the chain without trusting RANKIGI.

Quickstart

One wrapped function becomes a receipt.

The SDK is non-blocking. If RANKIGI is unavailable, your agent continues and the SDK records the transport failure.

.env setup
# Enroll an agent and write .env automatically (recommended):
npx @rankigi/cli init

# That writes one credential token, which Rankigi.fromEnv() reads:
RANKIGI_CREDENTIAL=rnk_live_cred_v1...   # API key + agent + passport + signing key
RANKIGI_CHAIN_ID=...                      # optional

# Or set the four variables individually instead of RANKIGI_CREDENTIAL:
RANKIGI_API_KEY=...        # from rankigi.com/dashboard/keys (same key the curl example uses)
RANKIGI_AGENT_ID=...
RANKIGI_PASSPORT_ID=...
RANKIGI_SIGNING_KEY=...
seal-first-event.ts
import "dotenv/config";
import { Rankigi } from "@rankigi/sdk";

const rankigi = Rankigi.fromEnv();

const result = await rankigi.wrap(
  "first-tool-call",
  { tool: "send_email", to: "customer@example.com" },
  async () => {
    return { status: "sent", provider_id: "msg_abc123" };
  },
);

await rankigi.close();
console.log(result);

Verification

Do not trust the dashboard.

Export the chain and recompute it locally. The browser verifier and verify.py are the same product promise in two forms.

Open browser verifier
verify locally
# Export a chain bundle from the dashboard, then verify it locally.
python3 verify.py chain-export.json

# Or paste the sample bundle into:
# https://rankigi.com/verify

API

Use HTTP when an SDK is too much.

The ingest API accepts minimal event metadata and payload hashes. Use the SDK when you need passport signing handled for you.

curl
curl -X POST https://rankigi.com/api/ingest \
  -H "Authorization: Bearer $RANKIGI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "agent_id": "your-agent-uuid",
    "action": "tool_call",
    "tool": "send_email",
    "severity": "info",
    "payload": {
      "input": { "to": "customer@example.com" },
      "output": { "status": "sent" }
    }
  }'
POST
/api/ingest
Submit an event to a chain.
GET
/api/chains/[chainId]/closure-export
Export a closure bundle.
GET
/api/public/revocation
Check passport revocation without auth.
GET
/verify.py
Download the Python reference verifier.

References

Choose the shortest path.