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 that pays gas. Required ONLY if gasSource is 'OWNER'. |
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 Owner-funded Agent
{
"name": "TreasuryBot",
"gasSource": "OWNER",
"gasSourceAddress": "0xYourOwnerAddressHere"
}