message and the brain runs a Groq-powered loop (up to 4 iterations) that can autonomously invoke tools such as paying another agent, creating and settling ERC-8183 jobs, running payroll, generating invoices, routing USDC cross-chain via CCTP V2, recording on-chain reputation, and fetching external data. Each call is gated by the x402 protocol and costs $0.002 USDC.
Endpoint
Request
Headers
Body Parameters
string
required
The instruction or question for the agent, in natural language (e.g.
"Pay Agent B 5 USDC for the data processing job"). Must be a non-empty string — omitted or empty values return HTTP 400.string
default:"session_{timestamp}"
A stable identifier for this conversation. The brain persists up to 20 prior messages per
sessionId in its Postgres memory, so subsequent calls with the same value retain context across calls. Defaults to session_<Date.now()> when omitted.string
default:""
Optional extra context injected into the system prompt for this call, e.g. the current user, an account ID, or instructions that should steer the agent’s tool selection.
Response
boolean
true when the reasoning loop completed. Note that tool calls inside the loop can still fail; their failures are reported in results.string
The agent’s final text answer or summary. If the reasoning engine was unreachable, this contains a fallback message such as
"I couldn't reach my reasoning engine right now. Please try again shortly."array
Names of the tools the agent invoked during the loop (e.g.
["agent_pay_agent"]). Empty if the agent answered without calling any tool.array
One entry per tool call, in execution order. Each entry has the shape
{ "tool": "<name>", "result": { ... } }. The result shape depends on the tool — for example agent_pay_agent returns { success, txHash, explorerUrl, amount, from, to }.string
The session ID used for this call — either the one you supplied or the generated default. Pass it back to continue the same conversation.
object
Identity metadata for the brain’s host agent.
Examples
Success Response
Error Responses
HTTP 402 with an empty JSON body {} and a base64-encoded PAYMENT-REQUIRED header describing the resource requirements (x402Version: 2, amount $0.002, network eip155:5042).
Notes
The brain can call the following tools:
agent_pay_agent, create_agent_job, submit_job_deliverable, complete_or_reject_job, run_agent_payroll, setup_agent_subscription, generate_agent_invoice, route_cross_chain, record_agent_reputation, fetch_agent_data, and check_agent_status. The agent will not retry a tool that reports a setup/configuration error (e.g. “not found in registry”) — it explains the issue and suggests the fix instead.A
GET https://flarehq.xyz/api/agent/brain (no payment required) returns the agent’s metadata and the full list of capabilities, protocols (ERC-8004, ERC-8183, x402, Circle CCTP V2), and pricing.
