Skip to main content
A Wraith agent is your persistent identity on the network. It combines a human-readable .wraith name, chain-specific addresses, stealth cryptographic keys, and an AI model that understands natural language payment commands — all running inside Trusted Execution Environment hardware.

What an agent contains

When you create an agent, Wraith provisions:
  • A .wraith name (for example alice.wraith) registered on-chain
  • A wallet address on each target chain
  • A stealth meta-address on each target chain for receiving private payments
  • An AI agent inside the TEE ready to process natural language commands
You never handle the cryptographic keys directly. The TEE derives them on demand for every operation, then discards them from memory.

Creating an agent

Sign a message with your owner wallet to prove ownership, then call createAgent:
import { Wraith, Chain } from "@wraith-protocol/sdk";

const wraith = new Wraith({ apiKey: "wraith_live_abc123" });

// 1. Sign a message with the owner wallet to prove ownership
const message = "Sign to create Wraith agent";
const signature = await wallet.signMessage(message);

// 2. Create the agent
const agent = await wraith.createAgent({
  name: "alice",
  chain: Chain.Horizen,
  wallet: "0xYourWalletAddress",
  signature: signature,
  message: message,
});

agent.info fields

After creation, inspect the agent’s identity through agent.info:
console.log(agent.info.id);                          // UUID
console.log(agent.info.name);                        // "alice"
console.log(agent.info.chains);                      // [Chain.Horizen]
console.log(agent.info.addresses[Chain.Horizen]);     // "0x..."
console.log(agent.info.metaAddresses[Chain.Horizen]); // "st:eth:0x..."
FieldTypeDescription
idstringUUID that uniquely identifies this agent
namestringThe .wraith name without the TLD (e.g. "alice")
chainsChain[]All chains this agent is registered on
addressesRecord<Chain, string>On-chain wallet address per chain
metaAddressesRecord<Chain, string>Stealth meta-address per chain (e.g. "st:eth:0x...")

Reconnecting to an existing agent

If you already created an agent, reconnect without creating a new one. Three methods are available:
// By agent ID — no network call
const agent = wraith.agent("agent-uuid-here");

// By owner wallet address
const agent = await wraith.getAgentByWallet("0xYourWallet");

// By .wraith name
const agent = await wraith.getAgentByName("alice");
Use wraith.agent(id) when you already have the UUID — it avoids a network round-trip. Use getAgentByWallet or getAgentByName when you need to look up the ID from an identifier you have in storage.

Multichain agents

A multichain agent has one .wraith name with separate addresses and stealth keys on each chain. Pass an array of chains at creation time:
const agent = await wraith.createAgent({
  name: "alice",
  chain: [Chain.Horizen, Chain.Stellar, Chain.Ethereum],
  wallet: "0xYourWallet",
  signature: "0xSignature",
});

console.log(agent.info.chains);
// [Chain.Horizen, Chain.Stellar, Chain.Ethereum]

console.log(agent.info.addresses);
// {
//   horizen: "0xabc...",
//   stellar: "GABC...",
//   ethereum: "0xdef..."
// }

console.log(agent.info.metaAddresses);
// {
//   horizen: "st:eth:0x...",
//   stellar: "st:xlm:...",
//   ethereum: "st:eth:0x..."
// }
Use Chain.All to register on every chain the platform supports:
const agent = await wraith.createAgent({
  name: "alice",
  chain: Chain.All,
  wallet: "0xYourWallet",
  signature: "0xSignature",
});

Chain-aware chat

The AI agent infers the chain from context. When the asset is unambiguous it routes automatically:
await agent.chat("send 10 XLM to carol.wraith");
// XLM -> Stellar (unambiguous)

await agent.chat("send 100 ZEN to bob.wraith");
// ZEN -> Horizen (unambiguous)
When the chain is ambiguous, the agent asks:
await agent.chat("send 0.1 ETH to bob.wraith");
// "ETH exists on both Horizen and Ethereum. Which chain do you mean?"

await agent.chat("horizen");
// "Payment sent — 0.1 ETH to bob.wraith on Horizen..."
You can also be explicit:
await agent.chat("send 0.1 ETH to bob.wraith on horizen");

What the AI agent can do

When you call agent.chat(), the AI has access to a full set of payment tools:
ToolWhat it does
send_paymentSend a stealth payment to a meta-address or .wraith name
pay_agentPay another agent by .wraith name
scan_paymentsScan for incoming stealth payments
get_balanceCheck wallet balance (native + tokens)
create_invoiceCreate a payment invoice with a shareable link
check_invoicesCheck invoice payment statuses
withdrawWithdraw from a specific stealth address
withdraw_allWithdraw from all stealth addresses
schedule_paymentSchedule a recurring payment
list_schedulesList scheduled payments
cancel_scheduleCancel a scheduled payment
resolve_nameLook up a .wraith name
register_nameRegister a .wraith name on-chain
get_agent_infoGet full agent identity and TEE status
fund_walletRequest testnet tokens from faucet
privacy_checkRun a privacy analysis with scoring

Example: create an invoice

const res = await agent.chat("create an invoice for 1.0 ETH with memo consulting fee");
console.log(res.response);
// "Invoice created — [Pay 1.0 ETH](https://pay.wraith.dev/invoice/...)"

Example: run a privacy check

const res = await agent.chat("run a privacy check");
console.log(res.response);
// "Privacy Score: 85/100
//  Issues:
//  - (medium) 7 unspent stealth addresses — consider consolidating
//  Best Practices:
//  - Use a fresh destination for each withdrawal
//  - Space withdrawals at least 1 hour apart"

Exporting the private key

If you need to take the agent’s private key out of the TEE — for example, to migrate to self-custody — call exportKey with a fresh wallet signature:
const sig = await wallet.signMessage("Export private key for agent " + agent.info.id);
const { secret } = await agent.exportKey(sig, "Export private key for agent " + agent.info.id);
console.log(secret); // "0x..."
Key export requires a fresh signature from the owner wallet. Without that signature, nobody — including Wraith — can export the key.

Bring your own AI model

By default the agent uses Wraith’s hosted Gemini model. Pass your own model configuration to use OpenAI or Claude instead:
const wraith = new Wraith({
  apiKey: "wraith_...",
  ai: { provider: "openai", apiKey: "sk-..." },
});
Supported providers: "gemini", "openai", "claude".