Ask AI

Enable the in-docs chat panel on your production site with the CLI and an agent block in docs.json.

Before you begin

  • A published docs.page site on your repository's default branch (see Publish if you have not shipped yet)
  • GitHub admin access on the repository and GitHub CLI authenticated (gh auth login) or a token for --gh-auth
  • An API key from OpenAI, Anthropic, Google, or xAI
  • Context on how Ask AI fits with llms.txt and MCP (see Agent-ready docs)

For how the panel searches MDX, session security, and rate limits, see Ask AI on Features.


Enable the chat panel

Enable the Ask AI panel by running a CLI command, then set agent.key in docs.json:

  • Provision credentials with the CLI

    Register the agent: from any directory, run the create command with your GitHub repository and LLM provider name. The CLI encrypts your API key locally, verifies GitHub admin access, and registers the agent with docs.page. docs.page assigns a default model per provider:

    npx @docs.page/cli agent create --repo org/repo --provider openai

    Omit flags in an interactive terminal to be prompted for the repository, provider, and API key. On success, the CLI prints a random UUID string. Add this value to your agent.key configuration.

    For every flag, provider list, and error message, see docs agent create in the CLI. To rotate keys, pass --force on a second create run.

  • Wire the key into docs.json

    Connect the live site: add an agent block at the top level of docs.json with the key from the CLI output:

    json
    "agent": {
      "key": "value from cli"
    }

    Commit the change on a branch and merge to your default branch, or push directly when you are ready.

  • Publish to the default branch

    Ship the config: push or merge so the production URL at https://docs.page/org/repo reads the updated docs.json. Branch previews and commit URLs do not load the panel even when agent.key is present.

Customize the panel (optional)

After the agent is enabled, tune reader-facing copy and limits in docs.json without re-running create:

json
"agent": {
  "key": "value from cli",
  "placeholder": "Ask a question about this documentation…",
  "questions": [
    "How do I get started?",
    "Where is the API reference?"
  ],
  "limits": {
    "ip": 200,
    "repo": 10000
  }
}
  • agent.placeholder: Text shown in the empty question input
  • agent.questions: Starter prompts before the first message; clicking one sends it immediately
  • agent.limits.ip: Maximum chat requests per client IP per hour (default 200)
  • agent.limits.repo: Maximum chat requests per repository per hour (default 10,000)

Field behavior and defaults are documented on Ask AI on Features.

Verify

Open your production docs URL on the default branch, for example https://docs.page/org/repo. Confirm the Agent control appears in the site header (or press Ctrl+I), open the panel, and send a test question. You should see a streamed reply with links back to your pages.

If the control is missing, work through Troubleshooting before re-running create.

Troubleshooting

SymptomLikely causeFix
No Agent control on the live siteagent.key missing from docs.json on the default branchAdd the key from create output, commit, and push to the default branch
Panel missing on a preview or PR URLAgent loads only on the default-branch production URLOpen https://docs.page/org/repo without a ~branch suffix
Panel missing after a successful createagent.key in docs.json does not match the stored agentCopy the key printed by create exactly, or run create again with --force and update docs.json
GitHub auth error during creategh not logged in or token lacks accessRun gh auth login or pass --gh-auth with a token that has admin on the repo
Agent creation failed (403)Account is not a GitHub admin on the repositoryUse an account with admin access
Chat works locally in preview but not on the siteLocal preview never loads the agent panelVerify on the production default-branch URL after push

To remove stored credentials, run npx @docs.page/cli agent delete --repo org/repo. See Manage the AI agent for delete workflows and API base URL options.

Related

  • Agent-ready docs: llms.txt, MCP, and skills alongside Ask AI
  • Ask AI on Features: how the panel works, session security, and rate limits
  • CLI: flags and errors for docs agent create and docs agent delete