The Agent class provides methods for managing which DeFi protocols an agent can allocate to and what constraints govern those allocations. These are wallet-scoped operations that apply to a specific smart account.
There are two levels of protocol queries in the SDK:
giza.protocols(token) — Chain-level query on the Giza client. Returns active protocol names for a given token across the chain.
agent.protocols() — Wallet-scoped query on the Agent instance. Returns full Protocol objects configured for this specific agent.
The SDK provides protocol queries at two levels. Here is how they differ:
import { Giza, Chain } from '@gizatech/agent-sdk';const giza = new Giza({ chain: Chain.BASE });// Returns active protocol names for USDC on Baseconst USDC = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913';const { protocols } = await giza.protocols(USDC);console.log(protocols); // ['aave', 'morpho', 'moonwell', ...]
const agent = giza.agent('0xYourSmartAccountAddress');// Returns full Protocol objects for this agentconst protocols = await agent.protocols();for (const p of protocols) { console.log(p.name, p.tvl, p.apr);}
Use the chain-level query to discover available protocols for a token. Use the wallet-scoped query to inspect and manage the protocols configured for a specific agent.