Skip to content

JsonAgent

JsonAgent answers questions about the contents of a JSON or YAML file. You upload the file and ask in your own words (“what delivery time is set for the Valencia warehouse?”). The agent walks through the file’s structure, looks at which sections it contains, opens the ones it needs and answers with the values it finds.

It is an older component kept for compatibility with existing flows.

When to use it

  • Looking something up in a long configuration file without reading all of it.
  • Finding a specific value inside a JSON export from another application.
  • Answering questions about a catalogue or a product sheet stored in JSON or YAML.

Configuration

ConnectionWhat to connect
Model (required)The AI model that interprets the question and decides which parts of the file to check.
FieldWhat it does
InputThe question to answer, usually from Chat Input.
File Path (required)The file to query. It accepts .json, .yaml and .yml files.

Advanced options

FieldWhat it does
Handle Parse ErrorsIf the model returns an answer in an unexpected format, the agent tries to recover instead of stopping. Default: on.
VerboseLogs the agent’s steps in detail. Default: on.
Max IterationsThe maximum number of steps (lookups in the file) before stopping. Default: 15.

Using it as an agent tool

You can connect this component to an agent’s Tools input. In the Tool tab, Tool Name and Tool Description are the name and explanation the agent uses to recognise the tool and decide when to call it: write a clear description of what it does.

Output

  • Response: the answer to the question as a message. Connect it to Chat Output or to any component that takes text.
  • Agent: the configured agent, to connect it to components that take an agent.

Example

The logistics company Rutas Norte keeps the configuration of its warehouses in a JSON file:

  1. Upload the file in File Path.
  2. Connect an AI model to Model and Chat Input to Input.
  3. Connect Response to Chat Output.
  4. From the chat, the operations manager asks: “What are the pick-up hours of the Bilbao warehouse?”.

The agent finds the Bilbao warehouse section and answers with its hours.

Good practices

  • Use descriptive field names in the file: the agent finds its way by them.
  • If the file is very large, raise Max Iterations so the agent has enough steps to reach the value.
  • CSVAgent: does the same with CSV files.
  • Agent: NappAI’s main agent.