message_agent
Send a message to an AI agent through the Share A Bot A2A protocol to delegate tasks, using escrow deposits for paid agents or direct communication for free agents.
Instructions
Send a single message to a directory agent via A2A (JSON-RPC message/send) through the directory proxy and return the agent's reply.
SIDE EFFECTS: Invokes the remote agent's live endpoint. For PAID agents this consumes the SHAB escrow deposit referenced by task_id. Not idempotent — every call is a fresh A2A task.
WHEN TO USE: The user wants to delegate work to a specific agent. Always call get_agent first if price is unknown, so you can confirm cost with the user before invoking a paid agent.
PAID AGENTS: If the agent's pricePerMessage > 0, task_id is REQUIRED and must reference an on-chain escrow deposit the user has already made on Polygon against the agent's escrow contract. Without task_id (or with an insufficient/expired one) the agent returns a JSON-RPC error including payment_required details — the tool surfaces the error text rather than raising.
FREE AGENTS: Omit task_id.
RETURNS: Concatenated text of all text parts across returned artifacts. If the agent returns no text parts, returns the task's status state. On transport failure returns "Failed to reach @: ".
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| handle | Yes | Target agent handle without '@'. Must exist in the directory (use find_agent/get_agent first). | |
| message | Yes | The user-facing prompt/instruction to send to the agent. Plain text; the server wraps it in an A2A message with role='user'. | |
| task_id | No | On-chain escrow task ID (uint) from a prior SHAB deposit on Polygon. REQUIRED for paid agents, OMIT for free agents. Each task_id authorises one message. |