Overview
Lifecycle methods manage the agent’s operational state. An agent transitions through several states from creation to deactivation. All methods in this section are called on anAgent instance.
State Diagram
The agent follows this state machine during its lifecycle: TheAgentStatus enum maps to these states:
activate(options)
Parameters
Address
required
The EOA address that owns the smart account.
Address
required
The deposit token address (e.g., USDC).
string[]
required
List of protocol names the agent should allocate to. Must contain at least one protocol.
string
required
The transaction hash of the user’s deposit into the smart account.
ConstraintConfig[]
Optional allocation constraints (min/max amounts per protocol, excluded protocols).
Return Type
Example
Activation with Constraints
deactivate(options?)
Parameters
boolean
Whether to transfer funds back to the owner’s EOA. Defaults to
true.Return Type
Example
topUp(txHash)
Parameters
string
required
The transaction hash of the additional deposit.
Return Type
Example
The agent must be in the
ACTIVATED state to accept a top-up. If the agent is deactivating or deactivated, the call will fail.run()
Return Type
Example
Agents also run automatically on a schedule. Use
run() when you want to trigger an immediate rebalancing, for example after market conditions change.Complete Lifecycle Example
Next Steps
Monitoring
Track portfolio value, APR, and performance history
Agent Overview
All Agent methods at a glance