Skip to main content

Agent Wallet Example

This example shows how to set up strict guardrails for an AI agent-controlled wallet. The policy ensures the agent can only perform specific, bounded actions.

Scenario

You have an AI agent that:
  • Manages a portfolio by executing trades
  • Needs tight spending controls
  • Should not be able to drain the wallet
  • Must wait between actions to prevent rapid-fire trading

Policy Definition

Key Design Decisions

Why strict target allowlisting?

AI agents can be manipulated through prompt injection or adversarial inputs. A strict allowlist ensures the agent can only interact with known, trusted contracts — even if the agent’s reasoning is compromised.

Why deny approvals?

ERC-20 approve calls are one of the most dangerous operations. A malicious or confused agent could approve a drainer contract for unlimited tokens. By explicitly denying approval selectors, this attack vector is eliminated.

Why cooldowns?

If an agent enters a bad loop or is manipulated into rapid trading, the cooldown prevents it from draining the wallet through many small transactions. A 10-minute cooldown limits damage.

Why closed fail mode?

For an AI agent, security trumps availability. If Lit Protocol is unreachable and off-chain rules can’t be checked (slippage, simulation), it’s better to block the transaction than risk executing without guardrails.

Deployment

Monitoring

After deployment, use the CLI to inspect the active policy:
You can also simulate transactions the agent might attempt: