Method Signature
Description
Withdraws funds from an agent. Supports both partial and full withdrawal:- Partial withdrawal: Specify an
amountto withdraw specific funds while keeping the agent active - Full withdrawal: Omit
amountto withdraw all funds and deactivate the agent
Parameters
Smart account wallet address to withdraw from.
Amount to withdraw (in token’s smallest unit, e.g., 6 decimals for USDC).
- If specified: Partial withdrawal, agent remains active
- If omitted: Full withdrawal, agent is deactivated
"1000000000" for 1000 USDCWhether to transfer withdrawn funds to the origin wallet.
Only applicable for full withdrawal (when
amount is not specified).Return Value
For partial withdrawal:Withdrawal date.
Total value withdrawn.
Total value in USD.
Details for each token withdrawn:
token- Token addressamount- Amount withdrawnvalue- Value in tokenvalue_in_usd- Value in USD
Confirmation message.
Example
Output
Partial withdrawal:Error Handling
Common Errors
| Error | Cause | Solution |
|---|---|---|
ValidationError: wallet address is required | Missing wallet parameter | Provide a valid wallet address |
GizaAPIError: Insufficient balance | Requested amount exceeds available balance | Request a smaller amount |
GizaAPIError: Agent not active | Agent is not in active state | Only active agents can be withdrawn from |
Notes
Partial vs Full Withdrawal
Partial vs Full Withdrawal
- Partial withdrawal is useful for taking profits while continuing to earn yield
- Full withdrawal stops the agent completely and transfers all funds
Withdrawal Processing Time
Withdrawal Processing Time
Withdrawals may take time to process as the agent needs to withdraw funds from protocols. Use
pollWithdrawalStatus() to monitor completion.