Dune Analytics
Run SQL queries against on-chain data via Dune Analytics
Dune Analytics is the leading SQL-based on-chain data platform. It indexes decoded contract events, parsed transactions, and protocol metrics across EVM chains, Solana, Bitcoin, and more — and exposes them as queryable SQL tables.
In Agent Forge, the Dune integration lets workflows execute any saved Dune query and return the result rows directly. Use it to power crypto research agents, monitor DeFi protocols, track wallet activity at portfolio scale, build alerting around on-chain metrics, or pipe Dune-curated data into LLM analysis steps.
This is a bring-your-own-key (BYOK) integration. Each user supplies their own Dune API key.
Usage Instructions
Build and save a query at dune.com — Dune's editor gives you the query ID once saved. Paste that ID into the block, supply any query parameters as JSON, and pick how you want to run it:
- Run Query (wait for results) — fires the execution and polls until completion in a single block call. Best for fast queries that complete in a few seconds. The default timeout is ~7 seconds to stay under the proxy route's serverless limit (~10 seconds). If the query is still running at timeout, the response contains the
execution_idso you can poll with the operations below. - Execute Query (async) — returns an
execution_idimmediately. Use it with Execution Status / Execution Results in separate workflow steps for queries that take longer than a few seconds. This is the recommended pattern for any non-trivial query. - Latest Results (cached) — returns the most recent cached results without re-running the query. Cheapest and fastest.
CSV variants return the same data as a CSV string for piping into downstream blocks.
Tools
Run
dune_run_query- Execute a saved query and poll until completion, return rows in one calldune_execute_query- Start an async execution; returnsexecution_id
Poll
dune_execution_status- Get state of an execution (PENDING,EXECUTING,COMPLETED,FAILED, etc.)dune_execution_results- Result rows for a completed execution (JSON)dune_execution_results_csv- Result rows for a completed execution (CSV)dune_cancel_execution- Cancel a running execution
Cached
dune_latest_results- Most recent cached results for a saved query (JSON)dune_latest_results_csv- Most recent cached results for a saved query (CSV)
Common Inputs
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey | string | Yes | Dune API key (generate at dune.com → Settings → API) |
queryId | string | Operation-specific | Numeric Dune query ID |
executionId | string | Operation-specific | Returned by dune_execute_query / dune_run_query |
queryParameters | string (JSON) | No | JSON object of query parameter name → value |
performance | string | No | medium (default) or large |
pollIntervalMs | number | No | Poll interval for dune_run_query (default 2000) |
timeoutMs | number | No | Polling timeout for dune_run_query (default 120000) |
limit / offset | number | No | Result pagination |
Output
| Parameter | Type | Description |
|---|---|---|
data | json | Dune response payload (rows, metadata, or { csv } for CSV operations) |
Notes
- Category:
tools - Type:
dune - BYOK only. The platform does not hold a Dune API key.
- Free tier covers ~2.5k credits/month for development. Plus / Premier paid plans for production / commercial workloads.
dune_run_queryruns server-side and polls — it will block the workflow step until completion or timeout. For queries that may take longer than your workflow timeout, use the async pattern (dune_execute_querythen poll separately).- All operations are read-only and use the public Dune query API. Private query access works the same way as long as your API key has access to the query.