Skip to main content

What Is an Agent

An Agent is a resource handle bound to a single smart-account wallet address. Every method on the Agent class operates on that wallet, so you never need to pass the address repeatedly. The Agent encapsulates the full lifecycle of an autonomous yield agent: activation, monitoring, withdrawals, rewards, and protocol management.

How to Get One

There are three ways to obtain an Agent instance, all through the Giza client:
MethodAPI CallUse Case
giza.createAgent(eoa)YesCreate a new smart account for an EOA
giza.getAgent(eoa)YesLook up an existing smart account by EOA
giza.agent(wallet)NoWrap a known smart-account address
import { Giza, Chain } from '@gizatech/agent-sdk';

const giza = new Giza({ chain: Chain.BASE });

// Option 1: Create a new smart account
const agent = await giza.createAgent('0xUserEOA...');
console.log('New smart account:', agent.wallet);

// Option 2: Retrieve an existing smart account
const existing = await giza.getAgent('0xUserEOA...');
console.log('Existing smart account:', existing.wallet);

// Option 3: Wrap a known address (no API call)
const direct = giza.agent('0xSmartAccountAddress...');

The wallet Property

Every Agent exposes the smart-account address it is bound to:
readonly wallet: Address  // `0x${string}`
This is the address used in all API calls made by the agent. It is set at construction time and cannot be changed.

Method Categories

The Agent class groups its methods into six categories. Each is documented on its own page.

Lifecycle

Manage the agent’s activation state and trigger runs.
MethodReturn TypeDescription
activate(options)ActivateResponseActivate the agent with token, protocols, and deposit tx
deactivate(options?)DeactivateResponseDeactivate and optionally transfer funds back
topUp(txHash)TopUpResponseRecord an additional deposit
run()RunResponseTrigger a manual optimization run

Lifecycle

Full method reference with parameters, types, and examples

Monitoring

Track portfolio value, performance history, and APR.
MethodReturn TypeDescription
portfolio()AgentInfoCurrent portfolio state, deposits, status
performance(options?)PerformanceChartResponseHistorical performance data points
apr(options?)WalletAprResponseCurrent APR with optional sub-period breakdown
aprByTokens(period?)AprByTokenResponseAPR broken down by token allocation
deposits()DepositListResponseList of all deposits

Monitoring

Full method reference with parameters, types, and examples

Transactions

Browse transaction history, execution records, and logs. These methods return a Paginator for async iteration.
MethodReturn TypeDescription
transactions(options?)Paginator<Transaction>All wallet transactions
executions(options?)Paginator<ExecutionWithTransactionsDTO>Execution batches with transactions
executionLogs(executionId, options?)Paginator<LogDTO>Logs for a specific execution
logs(options?)Paginator<LogDTO>All wallet logs

Withdrawals

Withdraw funds and monitor withdrawal status.
MethodReturn TypeDescription
withdraw(amount?)WithdrawResponseInitiate a partial or full withdrawal
status()WithdrawalStatusResponseCurrent agent status and dates
waitForDeactivation(options?)WithdrawalStatusResponsePoll until deactivation completes
fees()FeeResponseCurrent fee structure
limit(eoa)LimitResponseWithdrawal limit for the EOA

Rewards

Claim and inspect accrued rewards. Paginated history uses the Paginator class.
MethodReturn TypeDescription
claimRewards()ClaimedRewardsResponseClaim all available rewards
rewards(options?)Paginator<RewardDTO>Paginated reward records
rewardHistory(options?)Paginator<RewardDTO>Paginated reward history

Protocols

View and update the agent’s protocol selection and constraints.
MethodReturn TypeDescription
protocols()Protocol[]Current protocol list for the agent
updateProtocols(protocols)voidReplace the agent’s protocol selection
constraints()ConstraintConfig[]Current allocation constraints
updateConstraints(constraints)voidReplace allocation constraints
whitelist()unknownGet the agent’s whitelist

Next Steps