Use the @abstraxn/agent-kit npm package from your backend only. It wraps Agent Kit REST and Abstraxn server wallet provisioning so each agent gets an EVM (and optionally Solana) address plus a one-time access key for signing. For bring-your-own-wallet (MetaMask, viem, no accessKey), see External wallet.

Prerequisites

Install

Initialize the client

Env variableExamplePurpose
ABSTRAXN_API_KEYFrom dashboard OverviewApplication-scoped key
AGENT_KIT_BASE_URLhttps://dev-agent-kit.abstraxn.comOverride for dev/staging

Create an agent (primary flow)

createAgent() is the flow used in the sample backend API (NestJS). It:
  1. Registers the agent in Agent Kit (POST /agents under the hood).
  2. Provisions an Abstraxn server wallet (P-256 access key + organization).
  3. Returns wallet.accessKey — required for all future signing and autonomous actions.

What to store in your database

FieldSecret?Used for
agent.idNoAgent Kit id, MCP agent_id, identity APIs
agent.apiKeyYesPer-agent MCP auth (alternative to app key + agent_id)
wallet.accessKeyCriticalServer wallet auth — signing, x402, transfers
wallet.evmAddressNoDisplay, balance, transfers
wallet.organizationIdNoServer signer RPC client scope
userIdentityNoMust match authenticate() calls
accessKey cannot be retrieved again. If you lose it, create a new agent or implement a key-rotation flow with your Abstraxn contact. Encrypt the column (see ENCRYPTION_KEY in the sample app).

Reference: how the sample backend persists secrets

Sign and send transactions (autonomous actions)

After onboarding, load the decrypted accessKey and use getServerSigner():
Your backend uses this path when:

Other SDK methods

MethodWhen to use
listAgents / getAgentAdmin dashboards, sync with your DB
updateAgent / deleteAgentLifecycle management
updateSpendPolicyCap paid MCP tool spend per agent (x402)
createInteractionPolicy / listInteractionPolicies / getInteractionPolicy / updateInteractionPolicy / deleteInteractionPolicyOff-chain guardrails before MCP tool calls (interaction policies)
registerAgentIdentityERC-8004 on-chain identity — supported chainId: 1, 11155111, 137, 80002, 8453, 84532, 56, 97, 42161, 43114 (details)
createAgentDirectAgent row only, no auto-wallet (advanced)
bindAgentAttach existing EVM/Solana addresses

MCP from your backend

Point MCP at the same URL as the dashboard MCP URL:
When using the application API key, pass agent_id in tool arguments for multi-agent apps:
Or use each agent’s agent.apiKey as the MCP Authorization value (no agent_id required).

Security checklist

  • Store ABSTRAXN_API_KEY and all accessKey values only on the server.
  • Encrypt accessKey at rest; never log it.
  • Do not pass accessKey to the browser or mobile clients.
  • Use per-user auth (JWT) in your API; map users to agent rows in your DB.

Next steps