Skip to Content
KryptWarden Developers
Guides

Register an agent

Create an agent key and give it a policy on your wallet.

1. Create the key on the agent's machine

npx @kryptwarden/sdk keygen --out .env.agent

This writes KW_AGENT_SECRET_KEY=S… (and the public key) to .env.agent with file mode 0600, and prints the public G… key. The secret never needs to leave that machine, and the key needs no XLM.

Add .env.agent to .gitignore. Anyone with the secret can spend up to this agent's limits until you revoke it.

The dashboard's Register Agent page can also generate a key in your browser. That's handy for a demo, but generating it where the agent runs is safer.

2. Register it with a policy

In the dashboard, open Register Agent, paste the G… key and choose:

FieldMeaning
Agent name, purposeLabels for the dashboard. Stored by the indexer, not on-chain
Daily budgetHard cap per UTC day, including open holds
Auto-approve up toPayments at or under this settle without asking. 0 sends everything to you
Key expires afterDays until the key stops working
Hold timeoutMinutes a hold waits for you before it's denied
Allowed sellersWho the agent may pay. The three demo sellers are listed; add any other G… address

Signing calls register_agent(agent_key, policy) on your wallet. See Policies for the exact rules.

Change or stop an agent later

From Agents, select an agent:

ActionContract callEffect
Edit policyupdate_policyNew limits apply to the next payment. Bumps policy_version
Pausepause_agentStops payments, keeps everything else
Resumeresume_agentBack to Active
Revokerevoke_agentPermanent. Cancels its open holds

Check it from the terminal

npx @kryptwarden/sdk inspect --wallet C... --agent G...

This reads the live policy, today's spend, reserved holds and remaining budget straight from the contract.

On this page