Report DuckDB 2.0 Agent Mode Cuts Output Tokens by 59%, but Not Overall Costs
DuckDB 2.0 introduces Agent Mode, which reduced query-output tokens by approximately 59% in DuckDB's own AI agent experiment. However, the reduction did not produce a meaningful improvement in overall agent costs or runtime.
By Vidyadhar. Published . 11 minute read.
The short version
DuckDB's Agent Mode experiment reduced query-output tokens from 123,600 to 50,800, approximately 59%, across 132 test runs.
All 132 runs returned correct answers, but saved output represented only about 0.5% of total input tokens, limiting the effect on overall costs.
Separate preliminary TPC-H testing reported approximately 25% higher composite performance for a DuckDB 2.0 alpha build compared with DuckDB 1.5.5.
DuckDB 2.0 Agent Mode reduced query-output tokens by approximately 59% in DuckDB's own experiment, but the improvement did not translate into a meaningful reduction in total AI agent costs or runtime. The finding shows why smaller database responses do not necessarily make an entire AI workflow cheaper or faster.
Released on 21 October 2026, DuckDB 2.0.0 LTS introduces Agent Mode alongside changes to networking, data types, asynchronous I/O and SQL functionality. The release is relevant to developers using analytical databases with AI coding assistants, but its features address different problems and should be evaluated separately.
We examined the published experiments and release information to distinguish measured results from expected benefits. The central lesson is that reducing unnecessary output can make agent interactions more efficient without guaranteeing improvements across the complete application.
Key findings
59% fewer query-output tokens: DuckDB reported a reduction from 123,600 to 50,800 tokens when Agent Mode was enabled.
132 correct runs: All runs returned correct answers across 22 TPC-H questions, with each question repeated three times in each configuration.
0.5% of total input tokens: The output saved by Agent Mode represented only a small share of the overall agent input.
237 versus 224 turns: Agent Mode required more agent turns than the configuration without it, and overall runtime did not materially improve.
25% higher composite performance: A separate preliminary TPC-H benchmark reported this improvement for a DuckDB 2.0 alpha build compared with version 1.5.5.
What DuckDB 2.0 changes
DuckDB is an embedded analytical database designed to run SQL queries within applications and local computing environments. Unlike a traditional database server, its core design allows applications to use the database engine directly without requiring a separate server process.
This approach makes DuckDB useful for local analytics, data exploration and workflows where developers want to query analytical data from scripts or applications.
DuckDB 2.0.0 LTS, released on 21 October 2026, adds several capabilities beyond the existing embedded database model.
These include CLI Agent Mode, Quack networking, asynchronous I/O, VARIANT support, triggers and an extensible SQL parser. The release also introduces database-file format changes that require attention during upgrades.
Agent Mode is particularly relevant to developers using AI coding assistants because it changes how the command-line interface presents query results and errors.
The broader engine improvements are separate from Agent Mode. They may affect database performance and application architecture even when no AI agent is involved.
How DuckDB 2.0 Agent Mode works
Database command-line interfaces traditionally format results for people reading a terminal. Output may include decorative table borders, spacing, repeated headings and lengthy error messages.
These details can help human users read results, but they also create additional text for AI coding agents to process.
When an agent runs a database query through a terminal tool, the output may become part of the information sent back to its language model. Large or repetitive responses can increase token consumption.
Agent Mode changes this presentation. It uses compact Markdown tables for query results and machine-readable JSON for errors.
The mode also supports explicit output limits and truncation notices. When results are shortened, the interface can indicate that truncation occurred and provide row-count information.
This is important because an agent should not mistake a shortened result for the complete dataset.
The release also describes query cost estimates and execution safeguards intended to make command-line database interactions more suitable for automated workflows.
These features help structure communication between the database and an agent. They do not independently determine whether the agent's reasoning or final answer is correct.
DuckDB Agent Mode benchmark results
DuckDB evaluated Agent Mode using Claude Code and a set of analytical questions based on TPC-H.
The experiment used 22 questions at scale factor 100. Each question was repeated three times with Agent Mode enabled and three times without it.
This produced 132 runs in total.
| Measure | Without Agent Mode | With Agent Mode |
|---|---|---|
| Query-output tokens | 123,600 | 50,800 |
| Agent turns | 224 | 237 |
| Correct answers across all runs | All runs correct | All runs correct |
| Overall cost improvement | Baseline | No material improvement |
| Overall runtime improvement | Baseline | No material improvement |
DuckDB reported that all 132 runs returned correct answers. This result applies to the tested questions and configurations, not every possible analytical workload.
The main measurable benefit was the reduction in query-output tokens from 123,600 to 50,800.
That represents approximately 59% less query-output text for the agent to process.
However, the experiment did not show a meaningful improvement in overall agent costs or runtime. The result demonstrates the difference between optimising a specific part of a workflow and improving the entire process.
Why 59% fewer output tokens did not reduce total costs
The headline token reduction is substantial, but it describes only the database query output read by the agent.
An AI coding assistant also processes user instructions, previous conversation content, tool descriptions, intermediate reasoning context and other information generated during a task.
Database output may therefore represent only a small part of the total information processed.
In DuckDB's experiment, the saved query output represented approximately 0.5% of total input tokens.
This explains why a large reduction in one category of output had little effect on overall costs.
The Agent Mode configuration also required 237 turns compared with 224 without it. Additional interactions can offset some of the benefits of shorter responses.
It is useful to distinguish several measurements:
Query-output tokens: The text returned by database queries and read by the agent.
Total input tokens: The broader information supplied to the language model during the workflow.
API cost: The expense associated with model usage, which depends on the relevant provider and usage pattern.
Database execution time: The time the database spends processing queries.
End-to-end agent runtime: The total time required for the agent to complete the task, including model interactions and tool operations.
Reducing query-output tokens does not automatically reduce database execution time. It also does not guarantee a proportional reduction in API costs or total runtime.
We would treat the 59% result as evidence that Agent Mode produces more compact output under the tested conditions, rather than proof of lower operating costs.
How Agent Mode activates automatically
DuckDB's command-line interface can activate Agent Mode automatically when it detects an appropriate AI agent environment.
According to the documentation, automatic activation requires a recognised AI agent environment variable, standard output that is not connected to a terminal and no explicitly selected output format.
Developers can also control the behaviour directly.
The -agent flag forces Agent Mode on, while -no-agent forces it off.
These options help developers compare output formats and avoid unexpected changes in scripts that depend on a particular presentation style.
Output limits can also be adjusted using CLI commands. This allows teams to control how much information an agent receives from large query results.
Developers should review truncation settings carefully. Compact output is useful, but hiding relevant rows can lead an agent to make decisions using incomplete information.
How AI coding assistants can use Agent Mode
Agent Mode is relevant to workflows where an AI assistant executes DuckDB commands and reads the results.
DuckDB used Claude Code in its published experiment. Similar command-line workflows may be possible with tools such as Codex and Cursor, depending on how those tools execute commands and handle their output.
However, the published benchmark does not establish identical behaviour or performance across different assistants.
For example, an agent may use DuckDB to inspect a dataset, identify missing values, calculate summary statistics or validate a transformation.
Compact Markdown output can make query results easier for the agent to interpret without requiring it to process decorative terminal formatting.
Machine-readable errors can also help an agent distinguish an execution failure from ordinary query output.
These changes improve the structure of database interactions. They do not remove the need to verify generated SQL or review important analytical conclusions.
Quack networking and the CONNECT statement
DuckDB 2.0 introduces Quack, a networking capability that allows DuckDB instances to communicate over a network.
The release also includes the CONNECT statement as part of its expanded connectivity features.
This is a notable change for a database traditionally associated with embedded analytical workloads.
However, Quack does not mean DuckDB has abandoned its embedded architecture or become equivalent to a conventional database server.
Networked access adds options for connecting instances and sharing access to data, but it also introduces operational considerations around connectivity, permissions and deployment.
Quack was still being refined towards full production readiness at the time of the announcement.
Organisations should therefore avoid assuming that every networking feature is suitable for critical production workloads without additional validation.
Teams considering Quack should review its current limitations, security model and compatibility with their existing applications.
Other important DuckDB 2.0 improvements
Asynchronous I/O
DuckDB 2.0 includes asynchronous I/O capabilities. These are intended to improve how the database handles certain input and output operations.
The practical benefit will depend on the workload, storage environment and execution pattern. The supplied evidence does not establish a separate performance improvement attributable only to asynchronous I/O.
VARIANT support
The release introduces VARIANT support, expanding the database's ability to work with flexible data structures.
This may be useful for analytical workflows involving data that does not fit neatly into a fixed relational schema.
Developers should still confirm the supported operations and compatibility requirements before using the new type in existing applications.
Triggers and SQL parser changes
DuckDB 2.0 adds triggers and an extensible SQL parser.
These changes expand the database's SQL capabilities and create additional options for developers building extensions or database-driven workflows.
However, new SQL functionality can also introduce compatibility questions for applications that depend on earlier parsing or execution behaviour.
Teams should test existing queries, extensions and application integrations before upgrading production environments.
DuckDB 2.0 engine performance compared with 1.5.5
Separate preliminary testing examined broader database engine performance rather than Agent Mode.
Using TPC-H at scale factor 1,000, DuckLabs reported approximately 25% higher composite performance for a DuckDB 2.0 alpha build compared with DuckDB 1.5.5.
This is a vendor-reported result from preliminary testing. It should not be interpreted as an independent benchmark of the final release.
It is also separate from the Agent Mode experiment.
The Agent Mode test measured AI agent interactions and query-output token consumption. The TPC-H engine comparison examined database performance under a different workload and configuration.
Combining these figures into a single performance claim would be misleading.
Developers should benchmark the final release against their own analytical queries, data sizes and hardware before expecting similar improvements.
Long-term support and migration considerations
DuckDB 2.0.0 is a long-term support release, identified as Cinnamon Teal.
DuckLabs announced support for DuckDB 2.0 LTS through at least October 2027. Support for DuckDB 1.5 was extended to March 2027.
These timelines give organisations a planning window for testing and migration.
However, DuckDB 2.0 introduces changes to the database-file format and includes some breaking changes.
Teams should not assume that database files, extensions and application integrations will behave identically after upgrading.
Before migration, developers should review release notes, confirm file compatibility and create reliable backups.
Applications that depend on older DuckDB versions may require additional compatibility testing or changes to their deployment process.
For production systems, a staged migration with a tested rollback plan is safer than replacing the existing version without validation.
Limitations of the published results
The Agent Mode experiment provides useful evidence, but it covers a defined set of analytical questions using a specific AI coding assistant.
Different agents may produce different command sequences, tool interactions and output requirements.
Workloads that return large tables may benefit more from compact output than tasks that produce short results.
Likewise, applications that already minimise query output may see limited additional savings.
Truncation introduces another risk. If an agent receives only part of a result and fails to recognise that rows were omitted, it may draw incorrect conclusions.
The experiment's correct answers do not prove that truncation or compact formatting will be safe for every query.
Finally, the broader engine benchmark was preliminary and vendor-reported. Its results should not be treated as guaranteed performance for the final release or for unrelated workloads.
Who should consider DuckDB 2.0?
DuckDB 2.0 is worth evaluating for developers who already use DuckDB for local analytics, embedded data processing or command-line workflows.
Agent Mode may be particularly useful when AI coding assistants repeatedly inspect query results or work with large analytical datasets.
Teams interested in expanded SQL functionality, flexible data types or networked access may also find the release relevant.
However, organisations with stable DuckDB 1.5 deployments should test compatibility before migrating, especially when they depend on existing database files or extensions.
Teams requiring mature networked database-server behaviour should examine Quack's production-readiness limitations rather than assuming it replaces a conventional server architecture.
For applications where AI agents rarely execute database queries, Agent Mode alone may not justify an immediate upgrade.
What this means for you
We recommend evaluating DuckDB 2.0 against your actual development workflow rather than relying on the headline token reduction.
Use the following checklist before adopting the release.
Establish a baseline. Record current query correctness, output size, total agent tokens, runtime and operating costs.
Compare Agent Mode configurations. Run representative tasks with Agent Mode enabled and disabled.
Measure complete workflows. Track total input tokens, agent turns and end-to-end runtime instead of measuring query output alone.
Check answer correctness. Verify that compact formatting and truncation do not remove information needed for accurate results.
Review output limits. Configure truncation settings appropriate to the size and purpose of your queries.
Test your AI assistant. Confirm how Claude Code, Codex, Cursor or another tool handles the new output format in your environment.
Benchmark database performance. Test representative SQL workloads separately from AI agent interactions.
Assess networking requirements. Review Quack's current limitations before relying on networked access in production.
Validate compatibility. Check database files, extensions, SQL behaviour and application integrations before upgrading.
Prepare a migration plan. Create backups, test the upgrade and document a rollback procedure.
The strongest reason to adopt Agent Mode is improved communication between DuckDB and automated tools. Its compact output and structured errors can make database interactions easier to process.
However, teams looking primarily for lower AI costs should measure the entire workflow. The published experiment shows that reducing query-output tokens can have little effect when those tokens represent only a small share of total usage.
Conclusion
DuckDB 2.0 introduces meaningful changes for developers, including Agent Mode, networking capabilities, asynchronous I/O and expanded SQL functionality.
Agent Mode's approximately 59% query-output token reduction is a clear result from DuckDB's own experiment. However, the same testing found no material improvement in overall agent costs or runtime.
The separate engine performance results are promising but preliminary and should not be confused with Agent Mode's benefits.
We recommend testing DuckDB 2.0 if your applications use analytical SQL or AI coding agents regularly. Compare correctness, token consumption, runtime and compatibility before upgrading, and treat the vendor benchmarks as starting points rather than guaranteed outcomes.
Where these numbers come from
The figures come from DuckDB's October 2026 Agent Mode experiment, its DuckDB 2.0 release announcement and DuckLabs' preliminary engine benchmark reporting from October 2026. These are vendor-published results, not independent LeadInDigital tests. The Agent Mode experiment and the separate TPC-H engine comparison used different configurations and measured different outcomes.
Sources
- DuckDB (9 October 2026). Agent Mode in the DuckDB CLI
- DuckDB (21 October 2026). Announcing DuckDB 2.0.0 LTS Cinnamon Teal
- DuckDB Documentation (Publication date not specified). Agent Mode
- DuckLabs (21 October 2026). DuckDB 2.0 Gives Developers More Ways to Connect, Query and Build
Questions people ask
What is DuckDB 2.0 Agent Mode?
Agent Mode is a command-line output mode designed for AI coding assistants. It uses compact Markdown tables, machine-readable JSON errors and explicit truncation notices to make database interactions easier for agents to process.
Does DuckDB Agent Mode reduce AI token usage?
In DuckDB's own experiment, Agent Mode reduced query-output tokens by approximately 59%, from 123,600 to 50,800. However, those savings represented only about 0.5% of total input tokens and did not materially reduce overall costs.
How do I enable Agent Mode in DuckDB?
You can force Agent Mode on using the -agent flag or disable it using -no-agent. It can also activate automatically when a recognised AI agent environment variable is present, standard output is not a terminal and no explicit output format has been selected.
Is DuckDB 2.0 faster than DuckDB 1.5?
Preliminary vendor testing reported approximately 25% higher composite TPC-H performance for a DuckDB 2.0 alpha build compared with DuckDB 1.5.5. This result is separate from Agent Mode testing and does not guarantee the same improvement for every workload.
Can DuckDB 2.0 run over a network?
DuckDB 2.0 introduces Quack networking, which allows DuckDB instances to communicate over a network. However, Quack was still being refined towards full production readiness at the time of the release announcement.
Should I upgrade to DuckDB 2.0?
DuckDB 2.0 is worth evaluating if you need its new SQL, networking or AI agent features. Before upgrading, test database-file compatibility, extensions, query correctness and performance using your existing workloads.