Integrations and development
Use the CLI in terminals and scripts
Ask questions from the command line, call AskTable in scripts, or let desktop AI assistants use AskTable through the CLI.
The AskTable CLI is the official command-line tool (npm package @datamini/asktable-cli, command asktable). It suits asking questions in a terminal, script automation, and letting desktop AI assistants such as Codex and WorkBuddy use AskTable through the AskTable Skill.
This page is written for CLI 0.0.18. The CLI and server are released separately; keep both reasonably current. If an older version lacks a command, rely on asktable --help.
Install
Requires Node.js 18 or later.
npm install --global @datamini/asktable-cli
asktable --versionSign in
asktable auth loginThis opens the browser by default; choose AskTable Cloud or a private deployment and confirm authorization to use AskTable as yourself. For private deployments, specify the API address with --server:
asktable --server https://asktable.example.com/api auth loginBrowser authorization shows the agents you can use across organizations and projects and supports automatic agent selection (see below).
asktable auth whoami --jsonasks the server to confirm the current identity, project, and role.auth statusshows only local configuration and does not prove the credential is valid.- Configuration is saved in
~/.config/asktable/config.json. Precedence: command options (--api-key,--server,--project,--org) > environment variables (ASKTABLE_API_KEY,ASKTABLE_API_URL,ASKTABLE_PROJECT_ID,ASKTABLE_ORG_ID) > configuration file > default servicehttps://api.asktable.com. Private deployments must specify the service address. asktable auth logoutsigns out;--localclears only local credentials. Keys in environment variables still take effect and must be removed from the runtime environment.
Ask questions
asktable query "What were sales this month?" --json- Without specifying an agent, AskTable chooses an agent you can use based on the question. Automatic selection requires browser authorization; with an API key, specify one with
--data-agent <id>. - Specify an agent:
--data-agent <id>. Useasktable discoverto see the projects you can access, agent purposes, and edit permissions at once, orasktable data-agent list --json. - Add a definition for this question:
--context "Sales are amount paid minus refunds", used only for this analysis. - Run mode:
--reasoning-mode fastordeep(defaultdeep). - Data identity for system integration keys:
--role <role_id> --role-variable dept_id=D001. Personal keys and browser authorization always use your own data role and cannot override it.
query checks for results every second and waits up to 120 seconds. After a timeout, view the original conversation with asktable conv get <conversation_id> instead of resubmitting the same question.
Follow-ups and clarifications
Continue with the returned conversation_id:
asktable query "By calendar month, using payment time" --conversation <conversation_id> --jsonWhen the status is clarifying, the agent is waiting for more information:
-
With one clarifying question, answer directly with
--conversation. -
With several clarifying questions, answer each with
--clarify-answers.question_indexandselected_optionsare both zero-based indexes, and free text goes incustom_text:asktable query "Answer clarifying questions" --conversation <conversation_id> \ --clarify-answers '[{"question_index":0,"selected_options":[1]},{"question_index":1,"custom_text":"East China only"}]'
When automatic selection needs more information before choosing an agent, keep the original question, put the extra details in --context, and ask again.
A status of warning, error, or paused means the turn did not complete normally; check the conversation details. When reusing a conversation, creation options such as --data-agent and --role are not reapplied.
Manage resources
Read the existing configuration before changing it, and read it back with the corresponding get command afterwards. Rely on asktable <command> --help for available commands:
| Resource | Commands |
|---|---|
| Data sources | ds list/get/create/update/delete, ds test-connection, ds upload |
| Metadata | ds meta get/preview/sync/export/import, ds field edit, ds table edit |
| Training sets | ds training list/create/update/delete |
| Agents | data-agent list/usage/get/create/update/delete |
| Business documents | data-agent document list/get/create/update/delete <agent_id> |
| Skills | skill list/get/create/update/delete |
| Scheduled tasks | data-agent schedule list/get/create/update/delete/trigger/logs |
| Roles, policies | role ..., policy ... |
| Conversations | conv list/get/update/delete/compact/cancel/artifacts, conv share get/create/delete |
| Projects, members, organizations | project ..., member ..., organization members |
Key points:
--datasourcesand--skillsindata-agent updatereplace the whole list; they do not append.--descis required for business documents; use--content-filefor long bodies, which takes precedence over--content.- After a data source
--waitfinishes, still read back the sync status and errors. - Delete commands ask for confirmation by default; add
--yeswhen certain. - Add
--jsonfor structured output; some write commands still print prompt lines, so check the output of each command in scripts.
Scheduled tasks
asktable data-agent schedule create <agent_id> --name "Daily report" --cron "0 1 * * *" --prompt "Analyze yesterday's orders"
asktable data-agent schedule update <agent_id> <schedule_id> --action-id <action_id> --enabled trueNew tasks are disabled. The notification method (--action-id, your Action in the current project) and enabling can only be set with update. Cron expressions are interpreted in UTC. Scheduled task commands match the server from CLI 0.0.14; upgrade older versions.
Let desktop AI assistants use AskTable
asktable get-skill > asktable-skill.mdget-skill outputs the AskTable Skill bundled with the CLI; install it into your assistant's skill directory according to its rules. The “Agent integrations” page also provides copy-ready installation guidance. After upgrading the CLI, export and update the installed skill again.
After installation, the desktop assistant can:
- Confirm the sign-in target and find the projects and agents you can use.
- Pass statistical rules you give for this question (such as “sales are amount paid minus refunds”) to AskTable along with the question.
- After your confirmation, save rules and field explanations for long-term reuse into an agent you can edit.
- Submit usage problems or feature suggestions when you explicitly ask. No separate feedback credentials are needed; it confirms the content with you before submitting.
The AskTable Skill is usage guidance for desktop assistants, different from analysis skills in agents.
Known limitations
- Embed commands:
data-agent embedstill uses the old API path, which does not match the server's current embed management API and may return 404. Manage embeds in the web app. - The CLI has removed the old
ats,glossary, andproject preferencecommands. queryno longer supports--datasources; the data scope is determined by the agent.
Common issues
| Symptom | Cause | Action |
|---|---|---|
| Not signed in or no API key configured | No usable credential | auth login, or set ASKTABLE_API_KEY |
auth status shows signed in, but calls fail | The credential was revoked or expired, or the service address is wrong | Check with auth whoami and sign in again |
| 401 | Authentication failed | Check the credential and service address; do not keep changing resources |
| 403 | No permission; being able to use an agent does not mean reading its full configuration | Check with auth whoami and can_manage in data-agent usage |
| 404 | The resource does not exist, is not in the current project, or the command uses an old API | Check the project and resource; for embed commands see known limitations |
Automatic agent selection fails without --data-agent | Using an API key, or the question matches no agent | Specify --data-agent |
| Asked to answer clarifications one by one | --clarify-answers was not used | Answer each as above |
| 120-second timeout | The analysis takes longer | View the original conversation with conv get |
| Requests go to Cloud | The private deployment service address is not set | Set --server or ASKTABLE_API_URL |