Repository navigation
Agent Activity
From 0.8.0 FormChem shows you everything agents do: a panel with every call they made, a chip in the title bar while one is changing your drawing, and a short outline around what each call changed. You can undo an agent's latest call and stop an agent in one click.
Window > Agent Activity (also the Agent Activity button in the Agents dialog) opens the panel at the bottom right of the canvas. It lists the calls newest first, one row each:
| Part of a row | What it shows |
|---|---|
| Tool and arguments |
draw_from_smiles smiles=CC(=O)Oc1ccccc1C(=O)O name=aspirin; long text is clipped, a molfile shows as its line count, and anything that looks like a token, password or key shows as (hidden)
|
| Status | Running, Done, Error or Refused, with the duration (a call that asked you includes the time you took to answer) |
| Agent, drawing and time | the agent's name as its client reports it, the drawing's title, the clock time |
| Tooltip | the first line of the answer the agent got |
| Undo | on the one call per drawing that is still the latest step of that drawing |
- Undo undoes that call's whole change, exactly as Edit > Undo would, and the row shows Undone (struck through). After you or another agent change the drawing, the call is no longer the latest step and Undo leaves the row; use Edit > Undo to step back to it.
- Click a row to open its drawing, select what the call changed and outline it. If the drawing is not open in this window, or the objects are gone, a note says so.
- Show calls from filters by agent. Clear empties the list (the log files stay).
- Stopped agents lists the agents you stopped, each with Allow again.
The panel keeps the newest 200 rows on screen of the 400 calls the engine keeps, and says so when there are more. It stays open or closed across reloads.
When a call changes the drawing you are looking at, the title bar shows a chip beside the document title: "[agent] is editing" while it runs, "[agent] just edited" for three seconds after. At the same time the edge of the canvas lights up and each object the call changed is outlined for about two seconds. With reduced motion turned on in your system, nothing pulses or fades: the outline simply appears and goes.
- Click the chip's name to open Agent activity on that call.
- Stop stops that agent: its next calls are refused, reads included, and Always allow is withdrawn, so every outside agent asks you again before its next change. A call already running finishes. The toast says how to let it back in.
A drawing an agent makes for you (with draw_from_smiles and no drawing open, or new_document, open_document) opens in the window by itself, and what was drawn into it is outlined once it shows.
The engine logs every call in one place, whichever way the agent connected (HTTP, stdio, FormChem's own agent tabs or the chat panel). Besides the list in memory (the newest 400), each finished call is appended as one JSON line to Agent log/<start>-<pid>.jsonl in the data folder (~/formchem, or FORMCHEM_DATA_DIR). A file rotates at 1 MB, three older parts are kept, and the newest 20 engine sessions are kept. A call that runs a window command (run_command, extension_command) gets the change the window makes for it during the call or within 1.5 seconds after; if you edit in that moment, your change can be listed under the agent. Read-only calls are listed without a drawing.
| Route | What it does |
|---|---|
GET /api/agents/calls?limit=&agent= |
the log, newest first, with undoable (drawing id to the call on top of its undo stack), the agent names, the stopped agents and the log file |
POST /api/agents/calls/clear |
empties the log in memory |
POST /api/agents/calls/{id}/undo |
undoes the call while it is the latest step of its drawing, else 409
|
POST /api/agents/stop {agent} |
stops an agent |
POST /api/agents/allow {agent} |
lets a stopped agent in again |
GET /api/agents/token |
the agent token, for the Agents dialog |
The POST routes and the token route need the window key, so only the FormChem window can undo, stop or read the token. The live socket sends agentCall when a call starts, ends and gets its change, agentUndoable when the undoable call of a drawing changes, agentAccess when an agent is stopped or allowed and agentCallsCleared.
Code: backend/app/services/agent_log.py and backend/app/routers/agent_activity.py in the engine; frontend/src/app/agent-calls.ts, app/agent-activity.ts, ui/agent-activity.ts, ui/agent-chip.ts and canvas/agent-marks.ts in the window. See also Agents.
FormChem
- Home
- Manual
- Getting Started
- Drawing
- Grid and Page
- Annotations
- Reactions
- Templates
- Printing and pages
- Keyboard Shortcuts
- Stereo and Queries
- Analysis
- Names
- Spectra and NMR
- 3D
- Databases
- Lab Notebook
- Biopolymers
- Live Structures
- Accessibility
- Formats and Export
- Clipboard
- Command Line
- Agents
- Agent Activity
- Terminal
- Extensions
- Project Format
- Architecture
- Desktop
- Troubleshooting
- Development
- Releasing
Documents