Execute one or more kagiPro query objects against the Kagi API and write
raw JSON responses to disk. This function supports search, enrich (web/news),
summarize, and FastGPT query classes generated by query_search(),
query_enrich_web(), query_enrich_news(), query_summarize(),
and query_fastgpt().
Arguments
- connection
A
kagi_connection()object.- query
A query object of class
kagi_query_search,kagi_query_summarize,kagi_query_enrich_web,kagi_query_enrich_news,kagi_query_fastgpt, or a list of such objects.- limit
Optional integer limit used for search and enrich endpoints.
- output
Directory where JSON response files are written.
- overwrite
Logical. If
TRUE, existingoutputis deleted before writing.- append
Logical. If
TRUE, write into an existingoutputdirectory instead of deleting it.- workers
Number of parallel workers to use when
queryis a list.- verbose
Logical indicating whether progress messages should be shown.
- error_mode
Error handling mode.
"stop"(default) throws on request errors."write_dummy"writes a fallback JSON payload and returnsoutput.- metadata_request_args
Optional named list persisted in replay metadata (
request_args) for each query. Intended for higher-level orchestrators.
Details
If query is a list of query objects, requests are executed in parallel
(using workers) and each query is written into a named subdirectory under
output.
Files are written as {endpoint}_{page}.json (for example search_1.json).
Pagination is handled via meta$next_cursor when provided by the API.
Query replay metadata is written alongside JSON outputs:
per query folder:
_query_meta.json