You already have a coding agent. You should not need a second model API key just to load a CSV, run a query you can read, and save a chart.
AVA 4.0 is an open-source TypeScript framework from AntV for data analysis and visualization in JavaScript apps and AI agents. Its Agent Skill teaches your existing agent to use the AVA CLI. On the core path — source → schema → query → viz — the agent does the reasoning, AVA executes the work, and you do not configure a separate AVA model key. Your agent's own provider usage still follows that provider's pricing.
This matters because a useful analysis is one you can check. You should be able to see the SQL, the rows it returned, and the chart built from those rows.
This walkthrough uses the official 8-row sample from the Agent Skill guide. I also ran the same CLI commands locally against @antv/ava@4.0.5 on 1 December 2026. The totals match the documentation: January $30,000, February $37,500, net change +$7,500.
If you want to wire a custom agent loop in TypeScript instead, see Yuxin's earlier tutorial, Build a Data Analysis Agent with AVA 4.0, DuckDB, and TypeScript. That article uses the JavaScript API. This one stays on the Skill and the CLI.
What needs a model key, and what does not
The Agent Skill and CLI documentation draw a clear line:
- No separate AVA model key: loading structured data (
source), inspecting structure (schema), profiling, managing business definitions (semantic), executing a query you provide (query), and rendering a chart spec you already have (viz). - Model configuration required:
analyze,suggest,translate,recommend, andvisualize, plus text extraction. For dataset sessions, set those model variables before you runava source. Session model settings cannot be changed afterward.
Do not read "no second key" as "AVA never needs a model." It means the inspectable core path can run on the agent's own reasoning.
Prerequisites
- Node.js 22.13 or later
- npm
- macOS or Linux for the shell commands below (the Skill documents PowerShell equivalents for Windows)
Install the CLI and the Skill
From the Agent Skill guide:
npm install -g @antv/ava npx --yes skills add antvis/AVA --skill ava --yes Then check the install:
ava --help ava source --help npx --yes skills list ava --help should list source, schema, query, and viz. Start a new agent session after installation if your agent needs that to discover the Skill.
You can also skip the global install and call a project-local binary with npx ava, as the CLI reference describes.
Get the sample data
Download the official file and save it as sales.csv in your working directory:
https://ava.antv.vision/examples/agent-skill/sales.csv
It contains eight synthetic rows of monthly revenue, in USD, for four products:
month,product,revenue 2025-01,Analytics,12000 2025-02,Analytics,18000 2025-01,Automation,8000 2025-02,Automation,10000 2025-01,Reporting,6000 2025-02,Reporting,5000 2025-01,Support,4000 2025-02,Support,4500 A small file is easier to check by hand. You can add the January column and the February column on paper before you trust any tool.
Path A: ask your agent
After installation, start a new agent session and paste a prompt like the official demo (use the real path if you saved the file elsewhere):
Use the AVA skill to analyze ./sales.csv. Compare total revenue in January and February 2025, in USD. Calculate the absolute and percentage change. Break down the change by product, identify the largest contributor, and check that the product changes add up to the overall change. Do not infer causes that are not in the data. Save a horizontal bar chart of each product's revenue change as revenue-change.html in a new output folder. Include a short explanation, the results table, and the query used so I can reproduce the analysis. Ask the agent to show you the query and the result table, not only a summary. Wording and chart layout may differ from run to run; the calculations for this sample should match the table in the next section.
Path B: run the CLI yourself
This is the same core path the Skill uses, and you can audit every step. Commands follow the CLI reference. Redirecting source is important: in a terminal it prints a guide, and it prints JSON when piped or redirected.
ava source sales.csv > session.json DATASET_ID=$(node -p 'JSON.parse(require("fs").readFileSync("session.json", "utf8")).datasetId') ava schema "$DATASET_ID" > schema.json Read schema.json before you write SQL. For this CSV, AVA's DuckDB loader exposes a table named data, and the schema language is duckdb-sql. That table name is documented in the Agent Skill guide; always take it from ava schema for your own files.
Save this as query-totals.sql:
SELECT SUM(CASE WHEN month = '2025-01' THEN revenue ELSE 0 END) AS january_usd, SUM(CASE WHEN month = '2025-02' THEN revenue ELSE 0 END) AS february_usd, SUM(CASE WHEN month = '2025-02' THEN revenue ELSE 0 END) - SUM(CASE WHEN month = '2025-01' THEN revenue ELSE 0 END) AS change_usd FROM data; And this as query-by-product.sql:
SELECT product, SUM(CASE WHEN month = '2025-01' THEN revenue ELSE 0 END) AS january_usd, SUM(CASE WHEN month = '2025-02' THEN revenue ELSE 0 END) AS february_usd, SUM(CASE WHEN month = '2025-02' THEN revenue ELSE 0 END) - SUM(CASE WHEN month = '2025-01' THEN revenue ELSE 0 END) AS change_usd FROM data GROUP BY product ORDER BY change_usd DESC; Run them:
ava query "$DATASET_ID" --dsl @query-totals.sql ava query "$DATASET_ID" --dsl @query-by-product.sql query executes the DSL as written. It does not call a model, and session-level semantic definitions do not rewrite the SQL.
You should see these results:
| Product | January (USD) | February (USD) | Change (USD) |
|---|---|---|---|
| Analytics | 12,000 | 18,000 | +6,000 |
| Automation | 8,000 | 10,000 | +2,000 |
| Support | 4,000 | 4,500 | +500 |
| Reporting | 6,000 | 5,000 | −1,000 |
| Total | 30,000 | 37,500 | +7,500 |
The net increase is $7,500, or 25%. The four product changes add up to $7,500, so the breakdown reconciles. Analytics accounts for $6,000, which is 80% of the net increase. Reporting fell by $1,000 and partly offset growth elsewhere.
These figures show where the change occurred. The sample has no promotions, prices, or customer counts, so it cannot explain why.
Render a chart from the numbers you already checked
recommend and visualize need a model. viz does not: it validates a specification you provide and can write HTML. The documented GPT-Vis config shape is a type plus data rows. Save this as chart-spec.json, using the product changes from the query:
{ "chartType": "bar", "config": { "type": "bar", "data": [ { "category": "Analytics", "value": 6000 }, { "category": "Automation", "value": 2000 }, { "category": "Support", "value": 500 }, { "category": "Reporting", "value": -1000 } ] } } bar and this { category, value } layout follow AVA's published chart types and the column-chart example in the visualization guide.
ava viz --spec @chart-spec.json --output revenue-change.html --output writes a new file and will not overwrite an existing path. The HTML loads the pinned GPT-Vis 1.3.1 runtime from a CDN, so you need network access to view the chart. If the page is blank, check that access and compare the bars with the table above.
When you are finished, release the session:
ava dispose "$DATASET_ID" Sessions expire after 30 idle minutes. If that happens, load the source again, use the new dataset ID, and re-run schema and queries.
A compact installation prompt
If you want the agent to install and smoke-test the Skill for you, the official guide provides a prompt that includes this requirement: use your own reasoning for analysis, and do not ask for an additional AVA model API key. The full prompt is in the Agent Skill guide.
When you should configure a model
Use model configuration when you want AVA itself to suggest questions, translate natural language into DSL, run analyze, or recommend a chart from a question and a set of rows. Set OPENAI_API_KEY and, if needed, OPENAI_MODEL or OPENAI_BASE_URL before ava source for those session-scoped commands. Standalone recommend and visualize read the key at command time. Defaults are documented in the CLI reference (OPENAI_MODEL defaults to gpt-4o-mini).
What to read next
- Agent Skill guide — installation prompt and the official revenue demo
- CLI reference — flags, engines, and session lifecycle
- SDK quickstart — the same ideas in TypeScript
- AVA 4.0 release notes — why the framework is built around verifiable context
- Build a Data Analysis Agent with AVA 4.0, DuckDB, and TypeScript — a custom agent loop on the JavaScript API
AVA is MIT licensed. Issues and ideas are welcome at github.com/antvis/AVA.
Disclosure
This article was drafted with AI assistance and reviewed against AVA's official documentation. The CLI examples were executed locally with @antv/ava@4.0.5. The sample CSV and the expected totals come from the official Agent Skill guide.
