Skip to main content

Overview

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.

protocols()

Get the full list of protocols configured for this agent’s smart account, including metadata like TVL, APR, and pool information.

Signature

Returns

Promise<Protocol[]>

Protocol Type

Examples


updateProtocols()

Update the list of protocols the agent is allowed to allocate to. At least one protocol must be provided.

Signature

Parameters

string[]
required
Array of protocol names to enable for this agent. Must contain at least one entry.

Errors

  • ValidationError: Thrown if the protocols array is empty.

Examples


constraints()

Get the current allocation constraints for this agent.

Signature

Returns

Promise<ConstraintConfig[]>

ConstraintConfig Type

The kind field corresponds to one of the constraint types. Common constraint kinds include:

Examples


updateConstraints()

Replace the allocation constraints for this agent.

Signature

Parameters

ConstraintConfig[]
required
Array of constraint configurations to apply to the agent.

Examples


whitelist()

Get the whitelist configuration for this agent’s smart account.

Signature

Returns

Promise<unknown> — the whitelist data structure varies by configuration.

Examples


Chain-Level vs. Wallet-Scoped Protocols

The SDK provides protocol queries at two levels. Here is how they differ:
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.