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:
_10import 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.
_14import Safe from '@safe-global/protocol-kit'_14_14const SIGNER_ADDRESS = // ..._14const SIGNER_PRIVATE_KEY = // ..._14const RPC_URL = 'https://rpc.ankr.com/eth_sepolia'_14_14const safeClient = await Safe.init({_14 provider: RPC_URL,_14 signer: SIGNER_PRIVATE_KEY,_14 safeOptions: {_14 owners: [SIGNER_ADDRESS],_14 threshold: 1_14 }_14})
This creates a Safe Smart Account, but the actual smart contract will be deployed when you send the first transaction.