agent.create

create(name, gasSource?, gasSourceAddress?) → AgentDetails

Create a new AI agent with its own AA wallet on the Maroo chain. The agent is initially created in a PENDING state and takes 1-3 minutes to become ACTIVE as WaaS registers it on-chain.

Parameters

Name Type Required Description
name string ✓ Human-readable name for the agent (max 255 chars, unique per owner).
gasSource enum - Initial gas-funding mode. Must be 'SELF', 'OWNER', or 'PAYMASTER'. Defaults to 'PAYMASTER'.
gasSourceAddress string - Ethereum checksum address meant to pay gas in OWNER mode. Required ONLY if gasSource is 'OWNER'. OWNER is experimental: m-aws stores the address, but until on-chain routing ships the agent's own OKRW pays gas, as in SELF.

Returns

Type: object

Returns an object containing agentId, name, address, status ('PENDING'), gasSource, and gasSourceAddress.

Errors

Code Name Description
INVALID_INPUT InvalidInput Thrown if gasSource is OWNER but no address is provided, or if an address is provided for a non-OWNER mode.
AGENT_CREATED_GAS_FAILED AgentCreatedGasFailed Agent was created but the gas source flip failed. Retryable via agent.set_gas_source once ACTIVE.

Examples

Create a Paymaster-funded Agent

Creates an agent that uses the default sponsored gas.

{
  "name": "TradingBot_01"
}

Create an agent in OWNER mode (experimental)

gasSourceAddress is the owner address recorded for OWNER mode. Put in your own owner address; the one shown is an example. OWNER is experimental: m-aws stores the address, but until on-chain routing ships the agent's own OKRW pays gas, as in SELF.

{
  "name": "TreasuryBot",
  "gasSource": "OWNER",
  "gasSourceAddress": "0x8F3ac2B1d9E74c05A6B18FE27Dc4913e5A0F7b62"
}
ESC
Type to search