Docs / wallet / useAgentBalance

useAgentBalance

hook

Poll the connected wallet's AGENT token balance so built apps can check whether the end-user can afford an operation.

import { useAgentBalance } from 'flowstack-sdk/wallet'

Polls GET /billing/agent/balance for the connected wallet's AGENT token balance. For built apps that need to check whether the end-user has enough AGENT to run an operation.

Use data.available for spendable AGENT (balance minus active holds) and data.balance for total AGENT in the wallet.

Signature

const { data, isLoading, error, refetch } = useAgentBalance()

Returns

FieldTypeDescription
dataAgentBalance | nullBalance object: { balance, available, buildCredits, balanceWei, ... }.
isLoadingbooleanFetch in flight.
errorstring | nullLast error message.
refetch() => Promise<void>Manually re-fetch the balance.

Examples

Reading available vs total AGENT
const { data } = useAgentBalance();
// data.available — spendable AGENT (balance minus active holds)
// data.balance   — total AGENT in wallet

See also

useInferBalance · NeedsAgent · AgentBalanceBadge

Source: README.md#useagentbalance · Also available in llms-full.txt and registry.json.