Introduction
The@gizatech/agent-sdk is a TypeScript SDK that provides a simple and type-safe interface for interacting with Giza’s autonomous DeFi yield optimization agents.
The SDK wraps the HTTP API in a convenient TypeScript interface with automatic authentication, type safety, and error handling.
Installation
Quick Start
SDK Architecture
The SDK is organized into two main modules:Agent Module
Full lifecycle management of autonomous yield agents:
- Smart account creation
- Agent activation/deactivation
- Portfolio monitoring
- Withdrawal operations
- Rewards claiming
Optimizer Module
Stateless capital allocation optimization:
- Get optimal allocations
- Action plan generation
- Execution-ready calldata
Configuration
The SDK reads configuration from environment variables:| Variable | Required | Description |
|---|---|---|
GIZA_API_KEY | Yes | Your partner API key |
GIZA_API_URL | Yes | Giza backend URL |
GIZA_PARTNER_NAME | Yes | Your partner identifier |
Supported Chains
Error Handling
The SDK provides typed errors for common failure scenarios:SDK vs HTTP API
| Feature | SDK | HTTP API |
|---|---|---|
| Type Safety | ✅ Full TypeScript types | ❌ Manual typing |
| Authentication | ✅ Automatic | Manual headers |
| Error Handling | ✅ Typed errors | Manual parsing |
| Retries | ✅ Built-in | Manual implementation |
| Language | TypeScript/JavaScript | Any HTTP client |
HTTP API Reference
For direct HTTP access or non-JavaScript integrations, see the API Reference