Home
Quickstart Guides
Setup your Agent with a Safe account

Basic setup to equip your AI agent with a Smart Account

Get started with Safe AI integration in just a few steps.

This guide will help you set up a Safe Smart Account with the AI agent as the only signer. This 1-out-of-1 signer setup is discouraged by Safe, as it is not the most secure. However, many projects choose this setup for simplicity.

Installation

First, add the Safe Protocol Kit to your project:


_10
import Safe from '@safe-global/protocol-kit'

Creating a Safe Smart Account for your AI agent

When your AI agent is ready to interact with the blockchain, you can create a Safe Smart Account for it.


_16
import Safe from '@safe-global/protocol-kit'
_16
_16
const SIGNER_ADDRESS = // ...
_16
const SIGNER_PRIVATE_KEY = // ...
_16
const RPC_URL = 'https://rpc.ankr.com/eth_sepolia'
_16
_16
const safeClient = await Safe.init({
_16
provider: RPC_URL,
_16
signer: SIGNER_PRIVATE_KEY,
_16
predictedSafe: {
_16
safeAccountConfig: {
_16
owners: [SIGNER_ADDRESS],
_16
threshold: 1
_16
}
_16
}
_16
})

This creates a Safe Smart Account, but the actual smart contract will be deployed when you send the first transaction.

Was this page helpful?