Skip to content

The web interface

coder web runs the same agent in the browser. The chat page is the terminal interface with a window around it, and the settings page writes the model configuration for you — which is the part that is tedious in a text editor.

中文版:网页版

pip install "coder-agent[web]"   # uvicorn and jinja2 (fastapi is in the core)
cd my-project
coder web

The server prints the address it listens on and waits:

coder web: http://127.0.0.1:8765

Open that address in a browser.

The server runs until ctrl+c stops it. A browser tab holds the event stream open; the server ends those streams itself, so it stops at once.

The command line

Option What it does
--cwd The directory the agent works in. Everything the browser shows is inside it, except the directories in permissions.include_dirs.
--host The address to listen on. 127.0.0.1 by default.
--port The port. 8765 by default.
--model, -m The model of this run
--config, -c A configuration file, or key=value overrides
--permission-mode default, acceptEdits, plan, bypass or readonly

The pages

The chat page (/)

Three columns:

  • Left: the sessions of the directory and the files of the working directory. New session starts one; clicking a session opens it. A session is listed under the summary of its first question and not under its id; the counts (turns and cost) are in the tooltip of the entry. A model that has no price shows $? there: the money is unknown, not zero. The list shows the ten newest sessions; the button under it opens the rest and folds them back. The panel of the files stays at the bottom of the column and is never covered by the sessions: the two lists scroll on their own. The panel of the files lists the directories that are open to the agent (permissions.include_dirs) and nothing else: the other files and directories of the disk are refused.
  • Middle: the conversation. Messages are bubbles, tool calls are cards with the output and the diff of the change, approvals are cards with three buttons. The box under the conversation takes a message or a slash command (/help, /clear, /cost, … — the same commands as the terminal interface).

The page itself does not scroll: every column has its own scrollbar. The conversation follows the newest output, unless you scroll up to read something. The turns before the current one are folded into a block at the top — click it to look at them. A new turn folds the block again.

While the agent is thinking, the dots at the end of the conversation grow and shrink. They are the same dots as in the terminal, and they go away as soon as the agent says or does something.

The card of a tool that is running shows the same dots until the tool is done.

When you scroll up, a button (Jump to the newest) appears above the composer and takes you back to the end of the conversation.

The + button next to the box attaches a picture to the next message; a picture that is pasted into the box is attached the same way. The attached pictures are shown above the box, and each one can be removed before the message is sent. The picture goes to the model with the text of the message, not as a file on the disk: the agent sees it in the turn. The types are the ones a provider takes (png, jpg, gif, webp) and the limit is 5 MB per picture. A slash command cannot carry a picture.

An approval that waits for an answer scrolls itself into the middle of the view and pulses until you answer it, so that you never have to look for it. While it waits, the view stays with the card instead of running away to the newest output.

A turn that was cut off — at the ceiling of the model calls (agent.max_turns), at the budget or at the token limit — says so under the last answer. The agent that goes quiet has not crashed: it ran out of room. - Right: the status bar of the session (model, context size, cost, mode), the sub agents with the turns they may really make, the files the session changed with their diff, and the file you are looking at. A model that has no price shows $? instead of a cost: the money is unknown, not zero.

Everything the agent does arrives over a server-sent event stream, so the output appears while it happens. Reconnecting to the page picks up where it left off.

The pieces of a streamed answer are only for the moment: they are pushed to the browser while they arrive but not kept, so a long answer cannot push the history of the session out of the buffer. A browser that comes late reads the whole answer as one message.

At the end of a turn the session is settled in the memory (see The memory), which shows up as a thin separator with what it cost.

The settings page (/settings)

The model configuration, in a form:

Field What it is
Model name model.model_name, e.g. deepseek/deepseek-flash. The provider may be in front of the name (openai/MiniMax-M2.7, openai:MiniMax-M2.7) or left out (MiniMax-M2.7): the page shows the provider it worked out
API base model.api_base — the address of the provider
API key model.api_key, or the key of the provider in the environment. A click shows it, a second click hides it again. The page says where the key comes from: the settings, or which variable of the environment
Retries model.max_retries

The rest of the model is written in the configuration file, not on the page: the thinking budget (model.reasoning_effort), the verbosity (model.verbosity), the review model (model.review_model), the routing (model.routing and model.routing_rules), the extra parameters (model.model_kwargs) and the aliases file (model.litellm_config). The API still takes all of them: PUT /api/config/model writes what it is given, and a setting that is not sent stays as it is in the file.

The parameters of the call itself (model, messages, tools, stream, stream_options) belong to the agent: the page refuses them instead of writing a file that the agent would not start with.

The page reads the configuration files; the -m and -c of the command line are for the sessions, so with coder web -m deepseek/deepseek-flash the page still shows the model of the files.

Testing a model. The page has a Test button next to Save: it sends the settings of the form to the model and reports what came back — the model the call went to, the provider, the address, the latency, the cost, whether the model calls the tools (without that the agent cannot work), and the error, if there is one.

The test writes nothing. Saving is a step of its own: Save never waits for the test, and a setting that does not work yet is worth writing down, to be fixed later. The same two steps are in the terminal (coder model) and in the terminal interface (/model --test and /model --save).

The API has it too — POST /api/config/model/test with the settings of the form sends one cheap call to the model and reports seven things:

What What it tells you
The model The model the call goes to, and the alias it comes from
The provider The provider the name worked out to
The API base The address the call goes to
The API key Whether a key is set, and its last four characters
The key source Whether the key comes from the settings or from the environment
The aliases file Whether the file exists, whether it parses, and which aliases it has
The tools Whether the model calls the tools — without that the agent cannot work

What is written where: only the user level file, ~/.coderagent/config.yaml (or $MSWEA_CODER_HOME/config.yaml). The project level file (.coderagent/config.yaml) is never written — it is in the repository. The sections the page does not know about are kept as they are; the comments in the file are lost.

A setting that is the shipped default is not written at all: a field that holds the default is left out of the file, so that a later change of the default reaches a user who never touched it. A setting that was pinned in an older version is dropped the next time the page is saved.

A key in the environment is in the page. The page reads the configuration files first and then the environment: a provider key that comes from the environment (DEEPSEEK_API_KEY and the like) is shown like any other key, and api_key_set is true. The page says where the key comes from: the settings or the environment. The name of the model says which variable is looked at: openai/… means OPENAI_API_KEY, deepseek/… means DEEPSEEK_API_KEY.

The key of the field. The field of the key shows set (********1234) while the key itself stays hidden. A click on the field asks the server for the key and shows it; a second click hides it again. The key of the aliases file counts too: if the key lives in the litellm config file, that is the one that is shown. An empty field keeps the key that is set — the key is only sent when there is something in the field. The API is stricter about it: api_key: "" removes the stored key, and a missing api_key (or null) keeps it.

When it takes effect: the server keeps the configuration it started with. A new session reads the files again, so the new settings apply from the next session on. The session you are in keeps the model it has; use /model <name> to switch it right away.

The skills page (/skills)

The skills that are installed, and the way to install new ones from the network.

  • Installed: every skill in ~/.coderagent/skills/, with its description, its source and the digest of its content. A skill with no source is yours. Details opens the whole SKILL.md; a skill that came from the network also gets Check for an update, which fetches the source again and compares the digest, and Uninstall. The list stands five to a row and shows ten of them at a time, with a pager for the rest.
  • Built in: the skills that come with the agent. They are ready to use and nothing has to be installed. A skill of yours with the same name replaces one of them, and then it is no longer one of them. Five to a row and ten at a time, like the list above.
  • Install from the network: a field for a source and a button that downloads it. The download waits in the cache, and a dialog shows what it is — the source, the files, the digest and the whole SKILL.md — before anything is written to the disk. Install writes it to ~/.coderagent/skills/<name>/.
  • Sites: the tabs of the three skill repositories the Chinese community knows best, each with a Chinese name and a description. A tab shows six skills of its site at a time, with a pager for the rest, and a Sync button that fetches the site again. A click on a skill downloads it and opens the same dialog. The description of a card is cut at fifty characters; the mouse over it shows the whole of it.

See Skills for the sources, the limits and the lock file.

Permissions

The permissions are in two places, and they do different things.

Where What it changes When it takes effect
The settings page (/settings) The permissions: section of the user level configuration file The next session
The chat page (/) The mode of the session that is running Right away

The modes

Mode What it means
default Every tool that changes something asks for approval
acceptEdits The writes go through, everything else asks
plan Read only: the agent looks around and writes down the plan
readonly Read only: the agent looks around and answers
bypass Nothing is asked: every tool call is allowed. For unattended runs

plan and readonly refuse every tool that changes something, bash included, and the model is told about it, so it answers with what it found instead of changing anything.

bypass has no ceiling either: the money, the tokens and the number of the model calls do not stop a turn in this mode — it runs until the work is done and you stop it. Every other mode keeps those ceilings.

The settings page

The form has the mode, the denied paths, the extra directories and the network switch, and it is written to the same user level file as the model: ~/.coderagent/config.yaml (or $MSWEA_CODER_HOME/config.yaml). The project level file is never written, and the rules of permissions.rules are left alone — those are the business of the Always allow button of the approvals.

Like the model, it takes effect for the new sessions: a session that is running keeps the mode it has.

The chat page

The inspector has a mode box at the top. Changing it switches the mode of the session that is running, without restarting anything: the policy is changed in place, so the next tool call sees it, and the model is told about it the next time the context is put together. This is what makes an unattended run easy — put the session on bypass before the test run, back to default afterwards.

The mode the server was started with

coder web --permission-mode bypass pins the mode: it wins over the files, because the policy is built with permission_mode or config.permissions.mode. The settings page says so when the server was started with one, instead of letting you believe that a change in the file took effect.

The pin is the mode the sessions start with, not a lock: the chat page can still switch the mode of a session, because that is a decision you take in front of the session, not a setting of the file.

The language of the pages

The pages are in Chinese for a visitor from a Chinese region (China, Hong Kong, Macau, Taiwan) and in English everywhere else. The region of the visitor is what decides.

Where the region comes from How
The proxy in front of the server The header it sets: CF-IPCountry, X-AppEngine-Country, X-Vercel-IP-Country, X-Country-Code
The geoip database GeoLite2-Country.mmdb in ~/.coderagent/ (or the path in CODERAGENT_GEOIP_DB). It needs the geoip2 package, which is not a dependency of the agent
The browser The accept-language header, when the region is not known

The visitor always wins: the box in the top bar switches the language and remembers it in a cookie, and ?lang=zh (or ?lang=en) works on every page.

The switch does not leave the page: the page of that language is fetched and put in place, so the whole page — the text of the templates and the text the browser writes — changes language right away. The choice is kept in the browser as well as in the cookie, so a refresh does not change it back.

What decides, in this order:

  1. The choice of the visitor — the language in the box of the top bar (kept in a cookie) or ?lang=zh on the address. This one is the highest: a visitor from a Chinese region who picks English gets the English pages.
  2. The region of the address — a visitor from a Chinese region gets the Chinese pages, everybody else the English ones.
  3. The language the browser asks for — only when the region is not known, which is the case when the server is reached directly, without a proxy in front of it.

Adding a language

A language is added in three places:

  1. src/coderagent/web/templates/<code>/ — a copy of the directory of en/ with the text translated. base.html, chat.html, settings.html and macros.html are the files.
  2. src/coderagent/web/i18n.py — an entry in LANGUAGES (the code, the name of the language in that language, the name in English) and the strings of the browser in STRINGS.
  3. src/coderagent/web/i18n.py — the regions of that language in REGION_LANGUAGES, so that the visitors of those regions get it without asking.

A language whose templates are missing is not offered: the box in the top bar only lists the languages that can be served, and a language that is not served falls back to English.

The strings of STRINGS are the ones the browser shows while it works (the text of the buttons, the labels of the status bar). The text of the pages themselves is in the templates.

The API

Everything the pages do is a plain HTTP call, so you can drive the agent from a script. The interactive documentation is at /api/docs.

The endpoints that drive the agent or hand out the key ask for the header X-Coder-Client: 1: sending a message, interrupting, changing the mode, answering an approval, writing the configuration, reading the api key, and writing to the skills. A browser on another site cannot send that header without asking the server first, and the server does not grant it, so a page somewhere else cannot drive your agent. curl is not affected. Creating, resuming and forking a session do not ask for the header — they start nothing.

Method Path What it does
GET /api/sessions The sessions of the directory
POST /api/sessions A new session
GET /api/sessions/{id} One session
GET /api/sessions/{id}/events The whole session, read from the log
GET /api/sessions/{id}/items?since= The items the browser has not seen yet
GET /api/sessions/{id}/stream?since= The event stream (SSE)
GET /api/sessions/{id}/status The fields of the status bar
GET /api/sessions/{id}/metrics What the session cost
GET /api/sessions/{id}/changes The files the session changed, with their diff
POST /api/sessions/{id}/resume Continue a session of the log
POST /api/sessions/{id}/fork Copy a session
POST /api/sessions/{id}/messages Send a message, with its images, or run a slash command
POST /api/sessions/{id}/interrupt Stop the turn that is running
POST /api/sessions/{id}/mode Change the permission mode of the session
POST /api/approvals/{id} Allow, deny or always allow a tool
GET /api/commands The slash commands
GET /api/agents The sub agents, with the turns they may really make
GET /api/config The model and the permission configuration, as the settings page sees them
GET /api/config/model/key The key of the model, in clear text
GET /lang/{language} The language of the pages, remembered in a cookie
GET /api/i18n/{language} The strings of a language, for a browser that switches without a reload
PUT /api/config/model Write the model settings to the user file
PUT /api/config/permissions Write the permission settings to the user file
POST /api/config/model/test Try the settings out
GET /api/files?path=&depth= The entries of a directory
GET /api/file?path= The content of a file
GET /api/diff?path= The changes of the working tree
GET /api/skills The skills that are installed, and the ones that come with the agent
GET /api/skills/sites The sites of skills: one tab for each of them
GET /api/skills/sites/{site}?refresh= Every skill of one site; refresh=true fetches the site again
GET /api/skills/{name} One skill, with its SKILL.md
POST /api/skills/preview Download a source and show what it is
POST /api/skills/install Install a previewed skill
POST /api/skills/update Fetch the source of a skill again, and say whether it changed
POST /api/skills/registry The skills a registry lists
DELETE /api/skills/{name} Uninstall a skill

A turn that is already running makes the next message fail with 409. An approval that nobody is waiting for is a 404, and so is a session that does not exist. A path outside the working directory is a 403. A permission mode that does not exist is a 400, and so is an approval answer that is not allow, deny or always. A new session answers 201, a message that was taken answers 202.

The body of a message is {"text": "...", "images": ["data:image/png;base64,..."]}. The images are optional, and each of them is a data url of a type a provider takes, up to 5 MB. An image that is not one is a 400.

Approvals

A tool that needs permission waits for you. The card in the conversation has three buttons:

  • Allow — this call runs.
  • Deny — the call does not run and the model is told that you said no, so it can do something else.
  • Always allow — this call runs and a rule is written to ~/.coderagent/rules.yaml, so the same call — the same file, or the same command — is allowed from now on. The button says so.

If nobody answers, the call is denied (ui.approval_timeout seconds, five minutes by default). A tool that is denied never runs.

The security model

Read this before you put it on a network.

  • There is no authentication. Everybody who can reach the port can drive the agent, and the agent can run shell commands in the working directory. This is a tool for one person on one machine, the same trust you give the coder command line.
  • It listens on 127.0.0.1 by default. --host 0.0.0.0 prints a warning and serves to everybody who can reach the machine.
  • The browser cannot be tricked into it. The endpoints that drive the agent need a header that a cross-site request cannot send without a permission the server does not give.
  • The browser cannot look outside the working directory. Every path is resolved and checked against the working directory and the directories in permissions.include_dirs. The rules of the user cannot widen that.
  • The key is only shown on request. The settings page only gets api_key_set and the last four characters; the API hands out no other secret. The key itself is sent when you click the field of the key, and that request needs the header of the client, so a page somewhere else cannot ask for it.
  • The api key is written to the user file only, never to the project file that goes into the repository.
  • A download cannot reach into the network. The downloads of the skills page only go to https://, and a host that points inside the network is refused.

The differences from the terminal interface

Terminal Browser
Streaming Yes Yes, over SSE
Approvals Yes Yes, with the same three answers
Slash commands Yes Yes, the same ones
Pictures /image The + button, or a paste
The model configuration A text file A form
The files of the project The tools of the agent A tree on the left
The cost /cost The status bar, and /cost

The core is the same: the same sessions, the same event log, the same tools, the same permissions. A session started in the browser can be continued in the terminal with coder --resume <id>, and the other way round.

What the browser does not have yet: the terminal interface can pick the answer of an approval with the arrow keys, and it can fold a long output away. The browser shows everything.

Known gaps

  • The stream ends when the turn ends. A turn that says nothing for a long time keeps the connection open, but the browser has to reconnect after every turn.
  • The changed files come from the checkpoints of the session. A file that was changed without a checkpoint is not in the list.
  • Each session gets its own MCP server threads. The servers are only started when a session runs its first turn, but a lot of sessions means a lot of threads.

If the port is taken, the server says so and stops; start it on another one with --port.

FAQ

"api_key_set is false on the settings page" The key really is not there: not in the configuration file, and not in the environment under the name of the provider (DEEPSEEK_API_KEY and the like). The provider of the model decides which variable is looked at — openai/… looks at OPENAI_API_KEY. The page shows the provider it worked out and where the key comes from.

"I changed the settings and nothing happened" They apply to a new session. The session you are in still runs with the configuration the server started with; use /model <name> to switch right away.

"An endpoint answers 403" The header X-Coder-Client: 1 is missing. The browser sends it by itself.

"Sending a message answers 409" The session is busy running a turn. Wait for it, or stop it first with POST /api/sessions/{id}/interrupt.

"Reading a file answers 403" The path is outside the working directory. Change the path, or add the directory to permissions.include_dirs.

"The page is empty / cannot be reached" The server is not running, or the port is not 8765. The line coder web: http://… in the terminal is the address.

"Starting it says cannot listen on 127.0.0.1:8765" Another program has the port — usually a coder web that was not closed. The server says so and stops; use another one: --port 8766.

"The answer is shown twice" That was the front end of the older versions; it is fixed: the streaming bubble is replaced by the whole message that follows it.

"The stream broke after a turn" The stream of the events ends with the turn, and the browser reopens it with the new since; nothing is lost in between. A turn that says nothing for a long time keeps the stream open.