Skip to content
Queria Docs
English
Esc
↑↓navigate↵open⌘Jpreview
On this page

Have an agent write scheduled reports

Launch an agent with the Queria skill from cron or CI and delegate routine report writing

The interactive flow in Analyze with AI agents carries straight over to automation. Launch an agent with the Queria skill in non-interactive mode and you can delegate routine work like “look at this data every week and summarize what changed.”

Divide the roles

The key to stable reports is separating the deterministic part from the interpretive part.

  • Pin the numbers with SQL — spell out the aggregation queries in the prompt so every run measures the same thing
  • Leave interpretation to the agent — diffs against the previous run, outlier callouts, and prose summaries are what agents are good at
  • Fix the output format — specify the Markdown heading structure in the prompt to keep runs consistent

Prepare the prompt

Keeping it in a file like weekly-report.md makes it easy to version and swap:

You are a data analyst. Investigate the following with the Queria CLI
and write a Markdown report.

1. Top 10 prefectures by total population in 2024,
   from e_stat.ssds.a_pref_population
2. Compare against the latest Parquet under snapshots/ (the previous
   snapshot) and call out any changes in values or rankings

Structure the output under three headings: "## Summary", "## Numbers",
"## Observations".

Run in non-interactive mode

In a project directory with the Queria skill installed, use Claude Code’s non-interactive mode (-p):

claude -p "$(cat weekly-report.md)" > reports/weekly-$(date +%F).md

The agent drives queria search / schema / sql itself through the skill, interprets the results, and writes the report.

Put it on a schedule

0 9 * * 1 cd /home/you/queria-reports && ./run-weekly.sh

Running from CI such as GitHub Actions follows the same shape. Committing the generated report or posting it to chat is ordinary CI plumbing.

To do the same from an MCP client without shell access, see MCP server. Note that reading local files is not available over MCP, so work that involves local files — like comparing against snapshots — is better suited to the CLI (skill) route.

Rate limits

For scheduled runs, set an API token (queria auth set-token, or the QUERIA_TOKEN environment variable). Hitting the anonymous rate limit makes report generation flaky.

Was this page helpful?