Gizatech Agent SDK Skill
Product summary
Gizatech is a TypeScript SDK and MCP server for building autonomous DeFi yield optimization agents. Agents manage smart-account wallets, automatically rebalance capital across lending protocols (Aave, Compound, Morpho, etc.), and maximize yield while minimizing gas costs. The SDK provides two integration paths: Agentic (Giza handles execution) or IaaS (you bring your own infrastructure and consume optimization intelligence). Key files: @gizatech/agent-sdk (TypeScript SDK), @gizatech/mcp-server (MCP integration). Primary docs: https://build.gizatech.xyz
When to use
- Building yield agents: Create smart accounts, activate agents with token/protocol selection, monitor performance
- Integrating with Claude/Cursor: Use the MCP server to expose 22 tools for LLM-driven agent management
- Optimization workflows: Call the optimizer endpoint to get optimal allocations, APR improvements, and action plans
- Portfolio monitoring: Track APR, performance history, deposits, withdrawals, and rewards
- Custom execution: Use IaaS mode to get optimization intelligence while keeping your own smart account infrastructure
- Constraint-based allocation: Enforce diversification, cap exposure, exclude protocols, set minimum allocations
Quick reference
Configuration
| Parameter |
Type |
Required |
Env Fallback |
Default |
| chain |
Chain enum |
Yes |
— |
— |
| apiKey |
string |
No |
GIZA_API_KEY |
— |
| partner |
string |
No |
GIZA_PARTNER_NAME |
— |
| apiUrl |
string |
No |
GIZA_API_URL |
— |
| timeout |
number |
No |
— |
45000 ms |
| enableRetry |
boolean |
No |
— |
false |
Supported Chains
Chain.BASE (8453) - Base Mainnet
Chain.ARBITRUM (42161) - Arbitrum One
Chain.ETHEREUM (1) - Ethereum Mainnet
Chain.POLYGON (137) - Polygon Mainnet
Chain.SEPOLIA (11155111) - Sepolia Testnet
Chain.BASE_SEPOLIA (84532) - Base Sepolia Testnet
Supported Tokens
| Token |
Chains |
Decimals |
| USDC |
Base, Arbitrum, Ethereum, Polygon |
6 |
| USDT0 |
Plasma, HyperEVM |
Variable |
SDK Architecture
Two primary classes:
- Giza: Top-level client. Chain-level queries (protocols, tokens, stats, optimizer). Factory for Agent instances.
- Agent: Wallet-scoped handle bound to a single smart-account address. All lifecycle, monitoring, withdrawal, rewards, protocol operations.
Agent Lifecycle Methods
| Method |
Returns |
Purpose |
| activate(options) |
ActivateResponse |
Register initial deposit, token, protocols |
| deactivate(options?) |
DeactivateResponse |
Stop agent, optionally transfer funds back |
| topUp(txHash) |
TopUpResponse |
Record additional deposit |
| run() |
RunResponse |
Trigger manual optimization run |
Monitoring Methods
| Method |
Returns |
Purpose |
| portfolio() |
AgentInfo |
Current portfolio state, deposits, status |
| performance(options?) |
PerformanceChartResponse |
Historical performance data points |
| apr(options?) |
WalletAprResponse |
Current APR with optional breakdown |
| aprByTokens(period?) |
AprByTokenResponse |
APR by token allocation |
| deposits() |
DepositListResponse |
All deposits |
| transactions() |
Paginator |
All wallet transactions |
| rewards() |
Paginator |
Paginated reward records |
MCP Server Tools (22 total)
| Group |
Tools |
Purpose |
| Wallet |
connect_wallet, disconnect_wallet |
Session management |
| Account |
create_smart_account, get_smart_account |
Smart account creation/lookup |
| Lifecycle |
activate_agent, deactivate_agent, top_up, run_agent |
Agent state management |
| Portfolio |
get_portfolio, get_performance, get_apr |
Monitoring |
| Protocols |
get_protocols, get_protocols_supply, update_protocols |
Protocol management |
| Financial |
withdraw, claim_rewards |
Withdrawals and rewards |
| Optimizer |
optimize |
Capital allocation optimization |
| Support |
get_chains, get_tokens, healthcheck |
Chain/token discovery |
Error Types
ValidationError
GizaAPIError
TimeoutError
NetworkError
Decision guidance
| Scenario |
Use Agentic |
Use IaaS |
| You want Giza to handle execution, gas, smart accounts |
â |
— |
| You have existing smart account infrastructure |
— |
â |
| You want full automation after activation |
â |
— |
| You need custom execution logic or risk controls |
— |
â |
| You want optimization intelligence only |
— |
â |
| Task |
Use SDK |
Use MCP Server |
Use REST API |
| TypeScript backend integration |
â |
— |
— |
| Claude/Cursor agent tools |
— |
â |
— |
| Server-side API calls |
— |
— |
â |
| Custom LLM integration |
— |
â |
— |
| Constraint Type |
Use Case |
Example |
| MIN_PROTOCOLS |
Enforce diversification |
At least 3 protocols |
| MAX_ALLOCATION_AMOUNT_PER_PROTOCOL |
Cap exposure |
Max 50% per protocol |
| MAX_AMOUNT_PER_PROTOCOL |
Absolute cap |
Max 500M tokens per protocol |
| EXCLUDE_PROTOCOL |
Block specific protocol |
Exclude Euler |
| MIN_ALLOCATION_AMOUNT_PER_PROTOCOL |
Minimum per protocol |
Min 50M tokens |
Workflow
1. Initialize SDK and Create Smart Account
import { Giza, Chain } from '@gizatech/agent-sdk';
const giza = new Giza({
chain: Chain.BASE,
apiKey: process.env.GIZA_API_KEY,
partner: process.env.GIZA_PARTNER_NAME,
apiUrl: process.env.GIZA_API_URL,
});
const agent = await giza.createAgent('0xUserEOA...');
console.log('Smart account:', agent.wallet);
2. Get Available Protocols and Tokens
const protocols = await giza.protocols('0xUSDCAddress');
const tokens = await giza.tokens();
3. Activate Agent After User Deposits
const activateResponse = await agent.activate({
owner: '0xUserEOA...',
token: '0xUSDCAddress',
protocols: ['aave', 'compound', 'morpho'],
txHash: '0xDepositTxHash...',
constraints: [
{
kind: 'max_allocation_amount_per_protocol',
params: { protocol: 'aave', amount: '500000000' },
},
],
});
4. Monitor Portfolio and Performance
const info = await agent.portfolio();
console.log('Status:', info.status);
const { apr } = await agent.apr();
console.log(`Current APR: ${apr.toFixed(2)}%`);
const { performance } = await agent.performance();
performance.forEach(point => {
console.log(`${point.date}: $${point.value_in_usd}`);
});
5. Handle Withdrawals and Rewards
await agent.withdraw({
amount: '1000000000',
recipient: '0xUserEOA...',
});
const claimed = await agent.claimRewards();
await agent.deactivate({
recipient: '0xUserEOA...',
});
6. Use Optimizer for Custom Allocation (IaaS)
const result = await giza.optimize({
token: '0xUSDCAddress',
capital: '10000000000',
currentAllocations: { aave: '5000000000', morpho: '5000000000' },
protocols: ['aave', 'morpho', 'compound'],
constraints: [
{
kind: 'min_protocols',
params: { min_protocols: 2 },
},
],
});
console.log('Optimal allocation:', result.optimal_allocation);
console.log('APR improvement:', result.apr_improvement);
console.log('Action plan:', result.action_plan);
Common gotchas
- Smart account address is deterministic: Calling
createAgent() with the same EOA always returns the same address. Don’t create duplicates.
- Activation requires deposit tx hash: Must call
activate() after user sends deposit to smart account. Without tx hash, activation fails.
- API credentials are required: All authenticated endpoints need
GIZA_API_KEY and GIZA_PARTNER_NAME. Set as environment variables or pass to constructor.
- MCP tools require connected wallet: Most MCP tools fail if no wallet is connected. Call
connect_wallet first.
- Constraints are optional but recommended: Without constraints, optimizer may concentrate allocation in single protocol. Use
MIN_PROTOCOLS for diversification.
- Pagination is lazy:
Paginator doesn’t fetch all pages upfront. Use for await...of for automatic paging or .first(n) for limited results.
- Timeout default is 45 seconds: Network calls may fail if timeout is too short. Increase with
timeout: 60000 for slower networks.
- Deactivation is irreversible: Once deactivated, agent exits all positions and stops. User must go through activation flow again to restart.
- 10% fee on gains only: Withdrawal fee applies only to profits, never to principal. Clarify this in UI.
- Gas covered after activation: Initial deposit transaction requires native token for gas. All subsequent rebalances are gasless.
Verification checklist
Before submitting work with Gizatech:
- Environment variables set:
GIZA_API_KEY, GIZA_PARTNER_NAME, GIZA_API_URL
- Chain specified in config matches user’s network (Base, Arbitrum, etc.)
- Smart account created before activation attempt
- Deposit transaction confirmed on-chain before calling
activate()
- Token address is correct for selected chain (USDC vs USDT0)
- Protocols in activation request are supported on selected chain
- Constraints are valid (no conflicting min/max values)
- Error handling wraps SDK calls in try-catch with typed error classes
- Paginated results use
for await...of or .first() for proper iteration
- MCP server has wallet connected before calling agent-scoped tools
- API calls made from backend, not exposed to client-side code
- Tested on testnet (Sepolia, Base Sepolia) before production
Resources
Comprehensive navigation: https://build.gizatech.xyz/llms.txt
Critical documentation pages:
For additional documentation and navigation, see: https://build.gizatech.xyz/llms.txt