# Add inline Agno OS charts to any agent with ChartTools

> Agno's ChartTools toolkit gives an agent one create_chart tool. It checks bar, line, area, pie, horizontal and stacked chart data and returns a fenced chart block that Agno OS renders in the chat.

- Published: 2026-10-16
- Author: Anurag Sharma
- Categories: Changelog
- Canonical: https://www.agno.com/blog/add-inline-agno-os-charts-to-any-agent-with-charttools
- Markdown: https://www.agno.com/blog/add-inline-agno-os-charts-to-any-agent-with-charttools.md

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.

```python
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`.

````text
# 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.

```text
# 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](https://github.com/agno-agi/agno/blob/main/cookbook/05_agent_os/chart_responses/agentos_chart_responses.py), and learn more about [Agno toolkits](https://docs.agno.com/tools/toolkits/overview) in the documentation.
