Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.altheia.xyz/llms.txt

Use this file to discover all available pages before exploring further.

Five steps. About ten minutes.

1. Sign in as an operator

Open altheia.xyz/dashboard and connect Phantom. Your wallet becomes the operator authority. The first time you sign in, an OperatorAccount PDA is created on Solana.

2. Register your first agent

Click + Register agent. Give it a name, set per-tx + per-day caps, and pick the programs it can invoke.
Policy editor: per-tx and per-day caps, allowed programs
When you submit, you sign one transaction. The agent’s AgentAccount PDA is created and a Swig session key is provisioned with the policy mapped to on-chain constraints. Save the API key shown on success. It is revealed once.

3. Install the SDK

pnpm add @altheia-xyz/sdk
Or npm install / yarn add. The SDK targets Node 20+ and modern browsers.

4. Initialize

import { Altheia } from "@altheia-xyz/sdk";

const altheia = new Altheia({
  agentPda: process.env.ALTHEIA_AGENT_PDA!, // Solscan-linkable PDA from the dashboard
  apiKey: process.env.ALTHEIA_API_KEY!,
  failureMode: "closed", // halt the agent if the backend is unreachable
});
Defaults: endpoint is https://api.altheia.xyz, failureMode is "open", timeoutMs is 1500.

5. Guard an action

Wrap any signed action with guard(). If the policy denies it, guard() throws before your function runs.
import { PolicyDeniedError } from "@altheia-xyz/sdk";

try {
  const sig = await altheia.guard(
    { type: "transfer", asset: "USDC", amount: 50, target: recipient },
    async () => sendUsdc(recipient, 50), // returns the tx signature
  );
  console.log("landed:", sig);
} catch (err) {
  if (err instanceof PolicyDeniedError) {
    console.log("denied:", err.reasonCode, err.message);
  } else {
    throw err;
  }
}
Every call writes an audit row. Denials get an on-chain memo. Open the Chronicle tab in the dashboard to see them.

Full Orca swap example

A working agent that swaps SOL → USDC on Orca with six policy scenarios.