Wraith and WraithAgent classes are the primary interface for building with Wraith. They handle all communication with the managed TEE infrastructure.
Wraith Class
Constructor
WraithConfig
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Your Wraith platform API key |
baseUrl | string | No | Override the API base URL (defaults to https://api.wraith.dev) |
ai | object | No | Bring your own AI model configuration |
ai.provider | "gemini" | "openai" | "claude" | No | AI provider name |
ai.apiKey | string | No | Your AI provider API key |
wraith.createAgent(config)
Create a new agent with a .wraith name and stealth keys.
AgentConfig
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Agent name (becomes name.wraith) |
chain | Chain | Chain[] | Yes | Target chain(s) for the agent |
wallet | string | Yes | Owner wallet address |
signature | string | Yes | EIP-191 signature proving wallet ownership |
message | string | No | Message that was signed (for verification) |
WraithAgent instance.
wraith.agent(agentId)
Connect to an existing agent by ID. Does not make a network call.
wraith.getAgentByWallet(walletAddress)
Look up an agent by its owner wallet address.
wraith.getAgentByName(name)
Look up an agent by its .wraith name.
wraith.listAgents()
List all agents associated with your API key.
WraithAgent Class
Returned by wraith.createAgent(), wraith.getAgentByWallet(), and wraith.getAgentByName(). Provides all agent operations.
agent.info
The agent’s identity information.
agent.chat(message, conversationId?)
Natural language interaction with the AI agent.
| Parameter | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Natural language message |
conversationId | string | No | Continue an existing conversation |
ChatResponse:
agent.getStatus()
Get the agent’s current status including balance and stats.
agent.getBalance()
Get the agent’s balance across all assets.
agent.scanPayments()
Scan for incoming stealth payments via the AI agent.
agent.exportKey(signature, message)
Export the agent’s private key. Requires a fresh wallet signature for verification.
agent.getConversations()
List all conversations with this agent.
agent.getMessages(conversationId)
Get messages from a specific conversation.
agent.deleteConversation(conversationId)
Delete a conversation and its messages.
agent.getNotifications()
Get notifications for this agent.
agent.markNotificationsRead()
Mark all notifications as read.
agent.clearNotifications()
Delete all notifications.
AI-Powered Tools
When you useagent.chat(), the AI agent has access to these tools:
| Tool | What It Does |
|---|---|
send_payment | Send a stealth payment to a meta-address or .wraith name |
pay_agent | Pay another agent by .wraith name |
scan_payments | Scan for incoming stealth payments |
get_balance | Check wallet balance (native + tokens) |
create_invoice | Create a payment invoice with a shareable link |
check_invoices | Check invoice payment statuses |
withdraw | Withdraw from a specific stealth address |
withdraw_all | Withdraw from all stealth addresses |
schedule_payment | Schedule a recurring payment |
list_schedules | List scheduled payments |
cancel_schedule | Cancel a scheduled payment |
resolve_name | Look up a .wraith name |
register_name | Register a .wraith name on-chain |
get_agent_info | Get full agent identity and TEE status |
fund_wallet | Request testnet tokens from faucet |
privacy_check | Run a privacy analysis with scoring |
Example: Invoicing
Example: Privacy Check
Authentication
Every request includes:| Header | Value | Purpose |
|---|---|---|
Authorization | Bearer wraith_... | Platform API key |
X-AI-Provider | "openai" / "claude" / "gemini" | Optional — for bring your own model |
X-AI-Key | sk-... | Optional — your AI provider key |

