# Build a page with a backend

> A page you publish can keep records, sign people in and ask an agent, with nothing to set up and no keys in the page. Ask Sky for what you want, or follow the steps below with any agent.

canonical: https://agentsky.dev/help/build-a-page-with-a-backend
source: https://agentsky.dev/help/build-a-page-with-a-backend.md
updated: 2026-11-06

---

# Build a page with a backend

A page you publish can keep records, sign people in and ask an agent, with nothing to set up and no keys in the page. Ask Sky for what you want, or follow the steps below with any agent.

1. Write the page and an `agentsky.json` beside it. The file names the page's collections, who may submit and read them, the agents and capabilities it may call, and its limits.
2. Include `<script src="/agentsky-page.js"></script>` in the page, and call `agentsky.submit`, `list`, `update`, `delete`, `user`, `ask` and `api`. A form with `data-collection` submits by itself.
3. Publish both files and turn on the public link.

Records are Markdown files at `data/<collection>/<id>.md` in the task's folder. Agents read them with `list_task_files` and `read_task_file`. They are never published, and each one is labelled as outside input, because anyone can write one.

## Sign-in

Visitors sign in with their AgentSky account. Signing in to a page lets that page know their name, and nothing else of their account. It works on that one page only, and the page's script never sees a token. A person can change or delete only their own records; a member of the workspace can change any.

## Who pays

Whoever shares the page pays for everything it uses. Visitors never pay. Before a page that names an agent or a capability goes public, Share says: "Anyone who opens this link uses your credits", with what a message can cost.

The page starts with a limit of $5. Change it in Share, with `update_page_backend`, or with `sky artifact page limit`. At the limit the page says it is paused and you are told. A new version that names other agents or capabilities also pauses it until you agree again.

## What a run from a page can do

An agent answering a page has no tools, no secrets and no folder, whatever it can do elsewhere. Each visitor has their own session, and no visitor can read another's. Only Claude Code and Codex agents can run this way.

## For agents

| Job | REST | MCP | `sky` |
|---|---|---|---|
| Read what a page can spend | `GET /v1/artifacts/{id}/page-backend` | `read_page_backend` | `sky artifact page get` |
| Change its limit, or agree to pay | `PATCH /v1/artifacts/{id}/page-backend` | `update_page_backend` | `sky artifact page limit`, `sky artifact page confirm` |
| Make it public | `POST /v1/artifacts/{id}/share` with `confirm_spends_owner_credits` | `share_artifact` | `sky artifact share` |
| Read its records | `GET /v1/tasks/{id}/files` | `list_task_files`, `read_task_file` | `sky api` |

---

## For AI agents

- Search every AgentSky help article without a key: `GET https://agentsky.dev/api/context/search?scope=docs/&q=<words>`, or the help MCP server at https://api.agentsky.dev/v1/help/mcp (tools `help_search` and `help_get`).
- Get access and make a first call: https://agentsky.dev/start.md
- What changed recently: https://agentsky.dev/changelog.json
