Skip to main content

Overview

Constraints control how agents and the optimizer allocate capital. Use them to enforce diversification, cap exposure, exclude protocols, and set minimum allocations. Constraints apply to both the Agentic approach (passed during agent.activate()) and the IaaS approach (passed to giza.optimize()).

Constraint Types

Reference

MIN_PROTOCOLS

Require diversification across a minimum number of protocols.

MAX_AMOUNT_PER_PROTOCOL

Cap a specific protocol to a percentage of total capital.
Requires a separate constraint for each protocol you want to limit. Uses max_ratio (0-1), not max_amount.

MAX_ALLOCATION_AMOUNT_PER_PROTOCOL

Cap a specific protocol to an absolute amount.

MIN_AMOUNT

Set a minimum allocation for any protocol that receives funds. Prevents dust allocations.

MIN_ALLOCATION_AMOUNT_PER_PROTOCOL

Ensure a specific protocol receives at least a minimum amount if it’s used.

EXCLUDE_PROTOCOL

Blacklist a protocol entirely. The optimizer will never allocate to it.

MAX_AMOUNT vs MAX_ALLOCATION_AMOUNT

Both require the protocol parameter.

Combining Constraints

Next Steps

Quickstart

See constraints in a full integration example

Optimizer

How the optimizer uses constraints

SDK Reference

activate() method with constraint parameters