json_mode
How it works
- You create a JSON Mode tool, define its fields, and attach it to an agent.
- During a conversation, the agent decides the tool is relevant and calls it, filling the fields.
- AGO ends the turn and returns the payload to your application.
- Your application reads the payload and processes it.
Configuration
1
Create the tool
- Go to Agents > Tools and click Create Tool.
- Set Tool Type to
json_mode. - Enter a Name and a Description. The agent reads the description to decide when to call the tool.
2
Define the fields
In Input Schema (JSON), list each field the agent should fill, with a
type (str, int, float, bool, or a list such as str[]) and a description. The object the agent fills is exactly what your application receives.3
Attach it to an agent
Click Save, then open each agent in Agents and add the tool under Capabilities > Available Tools.
Reading the payload
The payload is attached to the agent’s message as a tool call of typejson_mode. You can read it two ways with the SDK API:
- Streaming: while reading the response stream, catch the tool call entry of type
json_mode. It carries the payload indata. - Request/poll: fetch the conversation and read the message’s
tool_call_data. Thejson_modeentry holds the payload indata.
When to use something else
- If the agent needs the result of an action to continue its answer, use a client function in
pausemode instead. - If AGO should call your API itself and use the response, use the HTTP Request Tool.
Related
- HTTP Request Tool: let the agent call an external API and use the response
- SDK API Reference: send messages and read conversations over the API
