Skip to content
Changelog

Add inline Agno OS charts to any agent with ChartTools

October 16, 20261 min read

Agno's create_chart tool, the only tool in the new ChartTools toolkit, takes chart_type, data rows and a config of series labels, plus x_key for axis charts or name_key and value_key for pie charts. It returns a fenced chart block that the agent pastes into its reply, and Agno OS draws it as an interactive chart. The toolkit ships its own instructions, so the agent needs no chart schema in its prompt.

from agno.agent import Agent
from agno.models.openai import OpenAIResponses
from agno.tools.chart import ChartTools
 
agent = Agent(
    model=OpenAIResponses(id="gpt-5.6-luna"),
    tools=[ChartTools()],
    instructions="You are a data analyst for Agno OS.",
    markdown=True,
)

We called the tool directly, with no model. A bar chart whose first row sends "42" as a string comes back with the number 42 and the series order filled in from config.

# real output: ChartTools().create_chart(chart_type="bar", x_key="model", config={"runs": "Runs"}, data=[...])
```chart
{
  "type": "bar",
  "data": [
    {
      "model": "Claude",
      "runs": 42
    },
    {
      "model": "Codex",
      "runs": 17
    }
  ],
  "config": {
    "runs": {
      "label": "Runs"
    }
  },
  "xKey": "model",
  "yKeys": [
    "runs"
  ]
}
```

When the arguments are wrong, create_chart returns a message the model can act on. A pie chart sent without its keys gets this reply.

# real output: create_chart(chart_type="pie", ...) with no name_key or value_key
Chart validation failed: pie charts require both name_key and value_key. Fix the arguments and call create_chart again.

The same check covers unknown chart types, empty data, nested rows, config keys missing from the data and series values that are not numbers. ChartType, ChartSpec, ChartSeriesConfig and ChartDataRow now live in agno.tools.chart as the typed shape of the payload.

See the cookbook, and learn more about Agno toolkits in the documentation.

Frequently asked questions

Bar, line, area, pie, bar-horizontal, bar-stacked and area-stacked. Pie charts need name_key and value_key; every other type needs x_key.

No. ChartTools adds its own instructions to the agent by default, so tools=[ChartTools()] is enough. Pass instructions= to replace them, or add_instructions=False to leave them out.

A message starting with "Chart validation failed" that names the problem and asks the model to fix the arguments and call create_chart again, so the model can correct itself before anything reaches Agno OS.

A series value such as "42" becomes the number 42. Labels such as a year in the x_key field stay strings.

Shipped around the same time