SDK API Reference

Exported functions and types from @economicagents/sdk.

Account

FunctionDescription
createAccountDeploy AEP account via factory
getAccountAddressGet predicted CREATE2 address
getDepositEntryPoint deposit balance
setFrozenFreeze/unfreeze account
getPolicyModulesList policy module addresses

Policy

FunctionDescription
checkPolicySimple policy check (boolean)
checkPolicyDetailedPolicy check with reason (BUDGET_EXCEEDED, etc.)
getBudgetPolicyStateBudgetPolicy caps and spend
setBudgetCapsSet BudgetPolicy caps
setBudgetCapsFullSet full caps including per-task
setRateLimitsRateLimitPolicy config
setReputationRegistry, setMinReputationCounterpartyPolicy
setIdentityRegistryERC-8004 identity
setUseAllowList, addToAllowList, removeFromAllowListAddress allowlist
setUseAgentAllowList, addAgentToAllowList, clearAgentAllowListAgent allowlist
addToBlockList, removeFromBlockListBlocklist
addVerifiedAgent, removeVerifiedAgentVerified agents
getReputationSummaryReputation summary for address

Execution

FunctionDescription
executeBuild, sign, submit UserOp via bundler
createAEPAccountCreate account client for execute

x402

FunctionDescription
interceptPaymentCheck policy before x402 payment
intercept402ResponseParse Payment-* headers and check
parsePaymentAmountParse Payment-Amount header
fetchWithPolicyCheckFetch with policy check

MPP / Tempo

FunctionDescription
classifyPaywallHeadersx402 vs mpp vs unknown from response headers
headersIndicateMppPaymentTrue if WWW-Authenticate uses Payment scheme
tempoSessionChallengeToPolicyExtract amount/recipient from parsed tempo/session challenge
tempoSessionProbeFromHeadersParse MPP session challenge from 402 headers (probes)
interceptMpp402ResponsePolicy check for MPP Tempo session 402
fetchWithMppPolicyCheckInitial fetch + MPP session policy pre-check

Constants: tempoChainId, tempoMainnet, tempoModerato, tempoEscrowContract, resolveTempoChain, resolveTempoChainId, etc.

Intent

FunctionDescription
parseIntentParse and validate intent JSON
IntentSchemaZod schema for intent

Relationships

FunctionDescription
createCreditFacility, getCreditFacilityStateCredit facility
creditDeposit, creditDraw, creditRepay, creditFreeze, creditUnfreeze, creditDeclareDefault, creditWithdrawCredit ops
createEscrow, getEscrowStateEscrow
escrowFund, escrowAcknowledge, escrowSubmitForValidation, escrowRelease, escrowDisputeEscrow ops
createRevenueSplitter, getRevenueSplitterState, splitterDistributeRevenue splitter
createSLA, getSLAState, slaStake, slaDeclareBreach, slaUnstakeSLA

Graph (from @economicagents/graph)

FunctionDescription
getAccountAnalyticsP&L, spend patterns
computeCreditScoreCredit score
getRecommendationsProvider recommendations
syncGraphSync economic graph
getFleetSummary, getFleetAlertsFleet

Constants

ExportDescription
baseSepoliaviem chain config
ERC8004_BASE_SEPOLIAIdentity, Reputation, Validation registries
USDC_BASE_SEPOLIAUSDC address

Types

TypeDescription
BudgetPolicyStateCaps and spend
PolicyCheckReasonBUDGET_EXCEEDED, COUNTERPARTY_BLOCKED, etc.
PolicyCheckResultallowed, reason
Intent, IntentBudget, etc.Intent schema types
ExecuteConfig, ExecuteCallExecute options
CreditFacilityState, EscrowState, etc.Relationship states