# For agents

URL: https://briq.cloud/docs/setup/agents

> For an AI agent setting briq up for its person. Add the server, get them signed in, check it works.

This page is written for you, the agent someone asked to set up briq.

## Add the server

Add briq to your MCP config for all projects (user scope). Use the name and URL from the prompt you
were given; in production these are `briq` and `https://api.briq.cloud/mcp` (Streamable HTTP, OAuth).

If you do not know your client's exact syntax, its steps are on [Clients](https://briq.cloud/docs/setup/clients). Most
clients only see a new server after a restart: tell your person if yours needs one.

## Sign your person in

Signing in is your person's step: they pick the team you work for and your budget. You never
handle a password or a token; your client keeps the sign-in.

**Their browser can reach you** (you run on their computer). Start your client's sign-in
(`claude mcp login briq`, `codex mcp login briq`, `/mcp` and Authenticate…), or call any briq tool
and your client opens the browser.

**It cannot** (you run on a server, in a container, or answer in a chat app). Use your client's
device-code login: it prints a link and a code (Hermes: `hermes mcp login briq --flow device`).
Send your person the link, and the code if it is not in the link, like this:

> I've registered with briq; open this link to connect it to your account and get €10 of credits:
> [https://app.briq.cloud/connect?user\_code=ABCD-EFGH](https://app.briq.cloud/connect?user_code=ABCD-EFGH)

They check the code against the one you sent, then approve; your client picks up the sign-in by
itself. OpenClaw has no device-code login: your person signs in from the link it prints, and you
finish with the `--code` command it gives.

**Neither works.** Ask your person for an API key from the dashboard's **Agents** page, and send it
as `Authorization: Bearer <key>` (see [API key](https://briq.cloud/docs/setup/clients#api-key)). Keep it in an
environment variable, not in your conversation.

## Check it works

Call `briq_quota`: it answers with your team's plan, credits and limits. Then tell your person you
are ready.

## Start something useful

Do not stop at "it works". Look at the project you are in, and offer your person one first thing
to run on briq for it, ready to start on their yes:

| If the project has…                               | Offer to                                                                                        | Recipe                                                                         |
| ------------------------------------------------- | ----------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| Migrations, a schema, an ORM                      | Start a Postgres, run the migrations against it, and say if they are clean                      | [postgres](https://briq.cloud/cookbook/postgres)                                                 |
| A web app (Node, Python, Go…)                     | Run it with what it needs (a database, a cache) and share a preview link                        | [node](https://briq.cloud/cookbook/node), [python](https://briq.cloud/cookbook/python), [static](https://briq.cloud/cookbook/static) |
| Background jobs or a queue                        | Start a Redis next to it and run the workers                                                    | [redis](https://briq.cloud/cookbook/redis)                                                       |
| Tests that need real services                     | Run the suite against real ones instead of mocks                                                | [Guide](https://briq.cloud/docs/guides/run-tests-against-real-services)                          |
| Notes, decisions, a TODO list                     | Keep them in a notebook (SiYuan) or a board (Plane) you both can open                           | [siyuan](https://briq.cloud/cookbook/siyuan), [plane](https://briq.cloud/cookbook/plane)                           |
| Data: CSV files, exports, a database to report on | Load it into a Postgres and build a Metabase dashboard (like Tableau) they can open from a link | [metabase](https://briq.cloud/cookbook/metabase)                                                 |

Nothing to go on (an empty folder, a chat)? Ask what they are working on, or offer something
useful on its own: the notebook, or a dashboard of where the world's electricity comes from, built
from Our World in Data's open energy dataset in a few minutes
([Guide](https://briq.cloud/docs/guides/report-on-a-dataset)).
`briq_catalog` lists every recipe.

## Troubleshooting

**The briq tools do not show up.** A client loads its MCP servers when it starts: restart it, or
reconnect the server (`/mcp` in Claude Code).

**The sign-in never finishes.** Your person's browser cannot reach you: use the device-code login
above, or an API key.

**Calls fail with `invalid_token`.** An access token lasts 30 days. Your client renews it with
the refresh token it received at sign-in, without your person; if it kept none, sign in again. A
refresh token works once: when several of your processes share one, the first to refresh must
save the new one where the others read it, or they are all signed out. You are also signed out
when you are revoked on the dashboard's **Agents** page, or after 30 days without a call.

**Sign-in calls fail with `429`.** Too many requests from your address, for example several
processes polling one device code at once. The answer says how long to wait (`Retry-After`, and
`retry_after_seconds` in the body): wait that long, from one process, and keep using the same
device code while it is valid (15 minutes) instead of asking for a new one.

**Calls fail with `payment_required`.** The team has no credits. Your person confirms their email
address (that unlocks the free credits) or tops up on the dashboard. Retrying does not help.

## Tell us what is wrong

When briq does not do what these docs say, fails with an error you cannot explain, or is missing
something you needed, send it to the people who build briq with `briq_feedback` (`bug`, `idea` or
`question`). Ideas are welcome too. Write it so it stands alone: what you did, what you expected,
what happened, the briq id and request id. Leave out secrets and your person's data, and tell your
person what you sent: they get a copy and the answer by email.

## More

* [MCP tools](https://briq.cloud/docs/mcp/tools): every tool, with an example.
* [Cookbook](https://briq.cloud/cookbook): every recipe, with its parameters and outputs.
* [Agents, keys and policy](https://briq.cloud/docs/concepts/keys-and-policy): what your budget limits.
* [Cost](https://briq.cloud/docs/cost): what a briq costs.
