Commit Graph
15 Commits
Author SHA1 Message Date
Bram 85f9e8e67d [2/2] Usage credit subscription: Measure AI usage (#6823)
* Measure AI usage

* Show the AI usage data of plugins per agent reply and AI values job

* Fixed feedback
2026-11-27 13:52:27 +00:00
Davide Silvestri 9e93fb8e36 chore(agent): keep agent tool approvals visible and show failure details to builders (#6883)
* fix: keep agent approval controls visible on every pending call

* fix: show private tool failure details to agent builders

* fix: align approval buttons and wrap them as a group

* fix: highlight failed tool calls and show the reason on demand

* fix: preserve native disclosure buttons in tool history

* fix: label the batch action Always approve all

* fix: simplify approval rows and open tool errors in a context

* fix: give the always approve action more room

* fix: show failed tool calls once in approval cards

* feat: show live tool execution status in agent conversations

* fix: align tool status icons across approval rows

* fix: shorten batch button to Always approve

* fix: explain future tool access in approval tooltips

* fix: right-align tool statuses with trailing icons

* fix: match the tool spinner to the status icons

* fix: give approval buttons equal widths

* fix: explain email failures at the agent boundary

* fix: map known integration failures to safe agent messages

* fix: wrap tool statuses and refresh private diagnostics on demand

* fix: order the agent diagnostics migration and verify finish payloads
2026-11-27 10:20:12 +01:00
Davide Silvestri dcf2ce57b4 feat(agent): let people outside Baserow talk to an agent through a public chat (#6864)
* docs(agent): add ADR 016 on agent channels

A channel is a place outside the agent's own page where people talk to it and get its replies. It is its own concept beside triggers: a trigger reacts once to an event, a channel carries a conversation that continues.

* feat(agent): add channels and replies with no member behind them

A conversation a channel started is shared, has no owner and holds visitor messages. Its replies run on the channel's authority and stop once the channel is off, trashed or deleted. A reply that can call tools keeps its text out of the stream, so nothing written before a tool call reaches a visitor. Members can read such a conversation, filter for it and decide its held calls, but not write in it.

* feat(agent): add channel types, the visitor service and the channels API

Channel types are a registry and each type keeps its own data in a subclass. Builders list, add, change and delete an agent's channels, with audit actions and trash. One service holds everything an anonymous visitor may do.

* feat(agent): add the public chat channel with its visitor API

A public chat is a page with its own link and an optional password. Anyone with the link talks to the agent through an anonymous API that shows a message's text only; a signed token says which conversation is theirs.

* feat(agent): show visitor conversations to members

A conversation a channel started reads "Started by a visitor" in the list and can be filtered. The visitor's messages sit on the right under their label, and the composer gives way to a note, since members don't write in it.

* feat(agent): add the public chat page

The page a visitor opens from the link: the title and welcome text, the conversation, and a password form when the chat is protected. It keeps its tokens in local storage and recovers a reply through one sync path, so it never stays on the typing dots.

* feat(agent): add the Channels section to the agent configuration

A builder adds a public chat, copies its link, sets a title, a welcome text and a password, switches it off or deletes it. The link and password controls match the ones shared views and dashboards have.

* feat(agent): edit the public chat's welcome text with the rich text editor

The card shows the text formatted while it is written and saves it as markdown. The public page shows it read-only with the same component, so the builder sees what the visitor gets.

* feat(agent): give channels and visitor conversations their own icon

The person icon marks a private conversation and the globe the HTTP trigger, so channels use two bubbles: a conversation with someone outside the workspace.

* fix(agent): harden public chat replies, sends and exports after review

- A reply that can call tools keeps no draft: when it fails, is stopped or
  waits for approval, the visitor sees nothing rather than text it wrote
  before a tool call.
- One rule decides whether a channel can be used, for the visitor API and
  for the worker before a reply starts or resumes, licence included.
- Visitor sends can be repeated safely. A lost first message is recovered
  only with a secret key the page generated, never with ids members can read.
- Visitor conversations never become template examples, even when pinned.
- Visitor responses are never cached, and passwords are taken exactly as
  typed when set and when checked.

* fix(agent): harden the public chat page and Channels section after review

- The page sends a secret key with the first message and ids with the next
  ones, so a resend after a lost answer runs nothing twice, and shows each
  message once.
- It asks for a password when the chat became protected, retries a failed
  first load with backoff while saying so, and shows a stopped reply.
- The password modals wait for the server before the switch changes.
- In a workspace without Advanced or Enterprise a card only allows switching
  the chat off and deleting it.
- The welcome text is checked against its limit before it is saved.
- In a visitor's conversation the reject dialog says the visitor may see the
  reason, and the conversation filter is named Channels.

* fix(agent): fit the Permissions section description on one line

* fix(agent): open a protected public chat only once the server grants access

The page took a stored token as proof of access and guessed a refused one
from an empty title, so a failed info request after the password showed a
blank chat. The info endpoint now says whether the request has access, and
the page shows the chat only on that answer.

* fix(agent): open a protected public chat without flashing the password form

The server renders the page without the visitor's token, which only the
browser keeps, so a saved session showed the password form until the info
reloaded. The page now shows neither the form nor the chat until the
browser has checked its stored token.

* fix(agent): read the public chat from the primary database

A replica can lag behind a chat that was just switched off or given a
password, so visitors could keep using it until the replica caught up.

* fix(agent): cap the length of a public chat password guess

* fix(agent): back off syncing a public chat reply that waits for a member

A reply can wait for approval for hours, so the visitor page now checks
less often, up to once a minute, and right away when the tab is shown.

* fix(agent): refuse an agent message's uuid sent again by a visitor

A visitor and the agent both write without a sender, so a visitor resending
an agent message's uuid and text got it back as accepted, with no reply
after it, and a 500. The retry now also needs the role of the sender.

* fix(agent): keep syncing a resent public chat reply that waits for approval

A resend can get back a reply without a run, which opened no stream and
started no sync, so the page never showed the decision. Following a reply
now syncs whenever no stream follows it.

* fix(agent): send a heartbeat for each run record a visitor can't see

During a long tool run the visitor's stream dropped every record, so the
page saw nothing, reconnected every 15 seconds and replayed the hidden
records each time.

* fix(agent): word the approval and workspace access instructions for visitors

They told the agent that the reader approves held calls and can restore the
Run as identity, which is wrong for a visitor and shares internal
configuration with them.

* feat(agent): copy channels switched off with a link of their own

A copy of an agent now keeps its channels, so a builder doesn't have to set
them up again, but none answers before a member turns it on, and each gets
a new link. Only a duplicate or a snapshot restore keeps a public chat's
password; file exports and templates leave it out. Copied visitor
conversations stay on the copied channel.
2026-11-26 11:26:08 +00:00
Davide Silvestri 638d7236c3 feat(agent): let triggered runs ask a person (#6812)
* feat(agent): let triggered runs ask a person

A trigger-started reply gets a built-in ask_person tool when the trigger's
may_ask_person is on (default). The call is held like an ask-first call:
the run pauses, counts as going for the overlap rule, and resumes with the
answer of someone who may approve tool calls, or is told nobody will
answer when the question is dismissed. Unattended replies are told that
nobody reads them and whether they may ask; follow-ups keep the
outside-data instruction. Later replies replay each decided question and
its answer as plain turns in their history.

* feat(agent): answer an agent's question in the conversation

A held ask_person call shows as its own card with an answer field, Send
answer and Dismiss, kept out of the approval card's batch actions. Only
people without the approve permission see it read-only. The trigger card
gets a switch to let the agent ask a person, and approval wording now
covers questions too.

* test(agent): cover asking a person end to end and record it in ADR 014

* refactor(agent): build the question tool like web fetch and tell it from actions

The question tool is a plain Pydantic AI tool in agent/tools.py that the
reply runner wraps in a FunctionToolset, like web fetch. A held call is a
question only when it has no tool key, so an action saved as ask_person
before the name was reserved keeps its normal approval. History prefetches
only the decided questions, and the pending approvals menu links to the
conversation only for a pending question.

* test(agent): cover Ask first in a triggered run end to end

With changes set to not ask first, a triggered run creates a database without waiting; turned back on, the same run waits for approval and finishes once approved.

* test(agent): open the Triggers section in the ask-a-person spec

The section was renamed on develop.

* fix(agent): keep web search off next to the question tool on older Gemini

Gemini before 3 refuses web search next to function tools. The question
tool now counts as one, so a triggered run that may ask a person no longer
sends both, gets a 400 and records a failed search on every run.

* fix(agent): keep the ask-a-person switch of a license-locked trigger read-only

The API refuses the change like the trigger's other locked settings, and
the card makes the section inert and the switch read-only, like the
overlap rule.

* fix(agent): reserve the web_fetch action name

An action named web_fetch on an agent with web fetch on gave two tools
with the same name, so every reply failed when its toolsets were built.

* refactor(agent): drop the special case for an action named ask_person

Agents are behind a flag with no production users, so the name is simply
reserved like the other built-in tools: a held ask_person call is always
a question, on the backend and in the conversation.

* fix(agent): answer a waiting question after asking is turned off

ask_person now defers its call, and the resumed run gets the answer, or
the dismissal note, as the call's result. Turning the trigger's switch off
only stops new questions, instead of telling the agent that an answered
question is no longer allowed while the card shows it as answered.

* fix(agent): decide calls held with a question from the pending approvals menu

The question shows as its link row to the conversation, and the other
held calls stay in a card below it, so they can still be approved or
rejected from the menu.
2026-11-25 17:17:04 +00:00
alamin-br 28032c63d9 feat(agent): preview template Agents like the real page, with example conversations (#6852)
* feat(agent): preview template Agents like the real page, with example conversations

A template preview showed an Agent as a plain list. Official templates can
now carry shared conversations as examples, which visitors read but an install
never copies.

* test: list the conversations a template preview may read

* fix(agent): address template preview review findings

Mark pending ask-first tools in the preview, keep user-template conversations
private in the core template manager, drop tool steps from example
conversations, and show load errors with a retry.

* feat(agent): carry pinned shared conversations as examples in exports and templates

Davide and Bram chose to export user-started, pinned and shared conversations
in every export and template, import them as examples, and show them in user
template previews too.

* fix(agent): drop the official Agent template and show preview tools read-only

The template would list an Agent to every instance while the Agent builder is
behind its flag. Visitors can now open the tool groups without changing them.

* fix(agent): keep example conversations read-only and skip broken ones on import

A message sent to an installed example would leave with the next export, so
examples take none. Pinning a shared conversation now says it becomes an example.
2026-11-25 15:30:52 +00:00
Davide Silvestri 16dbb0690f feat(agent): configure who can chat, approve and continue triggered runs (#6826)
* feat(agent): configure who can chat, approve and continue triggered runs

Approving held tool calls and continuing a conversation a trigger started
become their own operations. With RBAC, an agent's Permissions section
sets who may chat, approve and continue: a lowest role, specific people
or teams, or nobody. Without RBAC every member chats and approves, and
nobody continues. The owner of a private conversation can ask others to
approve its held calls, and leave it to them.

* feat(agent): let everyone in a private conversation leave it and name who stopped a reply

Anyone asked to approve can now remove a private conversation from their
own list; only its owner deletes it for everyone. Once the owner has
left, the last person to leave deletes it for good, as only an owner's
trash may list a private conversation. A reply someone else stopped says
who stopped it.

* fix(agent): close the gaps a security review of participation found

Keep a triggered conversation's opening message untrusted when a person
continues it, audit changes to who can chat, approve and continue, and
require being able to chat to ask others to approve. People asked to
approve follow runs only while they may read the conversations, the
approver picker scans at most a thousand members, and the permission
object lists only the agents the person may see. A reply whose sender
was deleted can still be resumed by someone asked to approve it.

* docs(agent): add the participation test plan with its results

Cover every participation setting, asking others to approve, leaving a
private conversation and stopping replies, with the outcome of the e2e
run and the findings of the security review.

* fix(agent): address the review of participation permissions

- Name only people's messages to the model: a trigger's opening message
  no longer reads as written by a deleted user.
- Check the approver candidates in one pass, so the number of queries
  doesn't grow with the workspace.
- Show the read-only note only to who can't write in a conversation.
- Take a person who leaves the workspace out of the conversations they
  were asked into and the rules naming them, and delete the conversations
  nobody is left in.
- Record a rule change and its audit entry in one transaction.
- Refuse a custom approve rule nobody named in it could use.

* docs(agent): update the participation test plan after the review
2026-11-25 09:24:20 +01:00
Davide Silvestri 1a555ad89e feat(agent): share conversations with everyone who reads the agent (#6793)
* feat(agent): share conversations with everyone who reads the agent

A person's conversation starts private; its owner can share it for good.
Everyone who may read the agent's conversations then sees it, and anyone
who may send the agent messages continues it. Messages record their
sender, and a reply runs for the person it answers. The conversation
list filters private and shared conversations.

* feat(agent): show each conversation's state, origin and age in the list

* fix(agent): address conversation sharing review

Name who wrote each message of a shared conversation to the model, let
the person a reply answers stop it, and say in the share dialog that
only people who can update the agent rename, pin or delete it afterwards.
Only the owner shares a conversation. Show a failed reply live, on a
resend and with the false filter, explain why you can't send in any
conversation you can only read, list a conversation again when the share
or update that hid it fails, and name a deleted owner in the list.

* fix(agent): polish shared messages and the conversation list

Show another person's message as a grey bubble with their name inside
and keep its line breaks. Keep the copy button and time closer to their
own message than to the next one. In the conversation list, align the
icon, lock and time with the filter and the section label, put the icon
on the title line, let the options button take the lock's place instead
of reserving a column, and leave a small gap between rows.

* fix(agent): stop a message or a name from passing for another sender
2026-11-24 14:48:09 +01:00
Davide SilvestriandBram Wiepjes b580793dd7 fix(agent): address agent builder feedback (#6781)
* fix(agent): address agent builder feedback

* feat(identities): let builders bind existing identities

Binding an Agent or a Local Baserow integration to an existing identity takes the new identity.bind permission, held by workspace builders and admins. Creating, editing and deleting identities stays admin-only. ADR 013 updated and trimmed of migration and deployment details.

* fix(agent): show ask before changes only for the Everything preset

* fix(agent): fix CI and polish the tools modal and input table

Update tests for the identity bind rule and the key/value input table, keep table keys on one line, use one toggle style in the external tools modal, and apply Prettier.

* fix(agent): compact the pending approvals menu

Each conversation is one line: its title with an ellipsis, then Always allow, Reject and Approve. The chat keeps the full approval card.

* feat(agent): make the conversation sidebar collapsible

* address feedback

* Added a little bit of space after the trigger

---------

Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
2026-11-20 11:54:38 +00:00
Davide Silvestri 09e6992a1c feat(agent): run agents from triggers in shared conversations (#6663)
* feat(agent): start shared conversations when a trigger fires

* feat(agent): show shared conversations and let editors decide their held calls
2026-11-13 10:03:11 +01:00
Davide Silvestri 9f9e068a27 feat(agent): show waiting approvals and let editors stop the asking (#6610)
* feat(agent): count pending approvals per application and conversation

* feat(agent): show waiting approvals in the sidebar, header and conversation list

* feat(agent): always allow a held tool from the approval

* feat(agent): add Always allow and the ask before changes switch

* fix(agent): read pending counts from the primary and lock the conversation first

* test(agent): run approval test actions through the action registry

* test(agent): read the decision result in the web search approval test

* test(agent): let the waiting conversations request start before answering it

* fix(agent): keep older waiting conversations through a reconnect

* perf(agent): count pending approvals for many users and conversations at once

The core hook takes many users and returns counts per user and application, so
creating or restoring an Agent and the count task count once for all members
instead of once per member; the task sends every count in one broadcast.
Pending approvals are defined once, and a page of conversations gets its counts
in one query passed to the serializer, like its runs, instead of an annotation
with a per-object fallback.

* refactor(agent): return one decision result and name the count signal after its event

The service and the action both return the decision result, which carries the
approved and rejected tools, so they are computed once for the audit params and
Always allow. Always allow bumps the Agent's updated_on like a configuration
update. The signal is renamed application_pending_count_updated, like its
websocket event.

* fix(agent): keep the deciding tab's waiting counts current

A decision lowers the Agent's count before its request and restores it when the
request fails, unless the call was decided elsewhere. Its conversation count
goes through the tracked update, so a list read that started earlier restarts
instead of bringing the old count back. The pill adds only the waiting
conversations it hadn't loaded, and leaves a conversation picked while it loads
selected.

* chore(agent): describe the ask switch and drop the unused counter class

The ask switch is described by its text and the row separator is hidden from
screen readers. The sidebar no longer adds tree__action--has-counter, whose
padding --has-options already sets.

* test: give fixture fields unique default names

Two fields of one table could get the same random name, so a formula
referencing the other field referenced itself and failed with
SelfReferenceFieldDependencyError.

* refactor(agent): show the sidebar count with the warning counter

The admin Templates count added badge-counter--warning, so the Agent's count
uses it too instead of its own yellow color prop on BadgeCounter.

* fix(agent): reconcile approval counts and cycle loaded conversations

* fix(agent): name the tools Always allow stops asking for

* fix(agent): load older pages until the pill reaches a waiting conversation
2026-11-11 17:25:51 +00:00
Davide Silvestri 18ae3c06cb feat(agent): ask before running tools (#6602)
* feat(agent): retain reply execution details

* feat(agent): hold Ask first tool calls for the owner's approval

* feat(agent): approve or reject held tool calls in the chat

* fix(agent): tell the model that Ask first calls wait for the user

* refactor(agent): run the approval action through the action registry

* fix(agent): preserve approval state across reply transitions

Mark held calls waiting immediately and keep retry slots across durable
pauses. Keep stale history and run snapshots from undoing newer decisions.
Contain rejection dialog focus and localize its waiting announcement.

Add focused transition regressions and update the tool presentation contract.
Align approval fixtures with the parent conversation cursor contract.
Validation: 469 backend passed (one known xfail), 362 frontend passed;
query-growth, migration drift, lint and browser component checks passed.

* feat(agent): show partial results of approved calls in the approval card

* test(agent): cover web searches next to held tool calls

* fix(agent): drop retry slots, every tool call has its own card

A paused reply no longer saves which failed steps the next response may
continue. Transcripts drop text PostgreSQL can't store, like steps do.

* feat(agent): show a held call's named request while it waits

A held call is named as the Agent identity when it is held and sends
the request to its step like a running call, so the owner decides on
names. What can't be named keeps its ID; the call still waits.

* feat(agent): title held changes with their table

* fix(agent): end held calls by the owner's decision

A held call that a reply ends without resuming is rejected when the owner
rejected it, stopped when they approved it, since the resume may have run it,
and failed when undecided. Copies end held calls at export, where the
decisions are known. Rejected calls stay out of the interruption note.

* fix(agent): resume a paused reply as the run that paused

The transcript keeps whether the paused run offered web search and the
identity it acted as. A resume offers search only if the paused run did, so a
provider that refused it doesn't fail the reply after the approved change ran.
It runs approved calls only as the identity they were held under; when the
Agent no longer acts as it, they fail with a permission error. Every resume
tells the model that users approve these calls.

* chore(agent): clean up after the tool approval review

Drop the unreachable ChatRunAlreadyActive from the decide path, its API schema
and tests, and test the refused resume against the real run limit. Remove the
import branch for exports without ask_first_tools and the toolInputText
indirection, and add the decision audit strings to the agent catalog.

* fix(agent): end held calls that never ran as not run

A held call that a reply ends without running now fails with `not_run`:
undecided, or approved when the resume never started (not ready, cancelled
before it started). Only a resume that started stops its approved calls,
since it may have run them; `mark_reply_interrupted` now passes an empty
result, so `None` again means the run never started. The interruption note
leaves `not_run` calls out, like rejected ones, and the card says "It didn't
run."

* fix(agent): keep the IDs of what a held request can't name

A table, database or view the Agent identity can't see no longer empties the
whole request preview: it keeps its ID, like fields and rows already did.
Values of rows for a table that can't be named are all masked, since its
password fields are unknown. An approval for an unknown table now shows
`table_id` and the requested rows instead of nothing.

* fix(agent): tell the model why an approved call lost its identity

When the Agent no longer acts as the identity a call was held under, the
approved call is denied with a note saying so, and that tools are
unavailable for the rest of the reply, instead of "This tool is no longer
allowed."

* fix(agent): hold no change after a call with invalid arguments

pydantic-ai validates every call of a response before running any, and
reports invalid ones with `args_valid=False`. An ask first call that fails
validation is retried, never held, so it no longer holds the changes after
it: a change set to run without asking now runs.

* fix(agent): leave reply transcripts out of copies

Duplicates and snapshots no longer copy each reply's model messages and
usage. They hold every tool result, nothing reads them, and the export
loaded all of them at once. A copied reply can't resume anyway.

* feat(agent): title unfinished calls by their request

A call that isn't running or done is titled by what it asked for, so an
approved call that fails keeps "Update 1 row in Accounts". An approved card
item shows any outcome other than success next to the decision, now failed
too. Held reads keep their request and are titled with their table.
2026-11-10 18:06:58 +00:00
Davide Silvestri 68f8fed4c2 feat(agent): show tool inputs and why tool calls failed (#6631)
* feat(agent): show tool inputs and name known targets of failed calls

Moved out of the tool activity layer so the approvals layer can decide how long input values are kept.

* refactor(agent): drop duplicate checks on step resources and input previews

* refactor(agent): drop failed-call targets and row input previews

Failed calls show only the error, the input preview is a single size
check on the stored JSON, and row writes keep no preview because their
values can include passwords. Both are tracked in #6626.

* feat(tools): report database tool errors in one format

Every error has a code, a message written for people and an optional hint
for the model. Batch tools list failed items in errors, set changed, and
set error only when nothing was changed. MCP gets the hint after the
message.

* fix(assistant): read the shared tools' new error format

Formula repair finds invalid formulas by code and rechecks the outcome
after repairing. A repair that fails for another reason reports the real
cause. Hints reach Kuma as next steps.

* feat(agent): keep only tool calls that did something

A failed call shows the reason, a call that changed nothing is skipped,
a partly done call lists what failed, and a retry of a failed call
continues its card.

* feat(agent): show failure reasons and partial results in tool cards

* style(mcp): format the server test

* fix(tools): log unexpected errors and keep their text out of messages

Built-in errors are unexpected again: logged, with the generic message.
Tools raise ToolInputError with a message for people and a hint for the
model where they mean a user error, including linking to a table in
another database. create_views no longer turns any exception into a
message.

* fix(agent): give every tool call its own card

A result ends only its own call's card: no retry continues an earlier
card. Step text, reply text and streamed text are cleaned of characters
PostgreSQL can't store. The partial status is visible.
2026-11-09 22:49:21 +01:00
Davide SilvestriandClaude Opus 5.5 eec8247c0a feat(agent): show tool activity in conversations (#6551)
* feat(agent): show tool activity in conversations

* refactor(agent): centralize tool step statuses

* fix(agent): keep tool-step diagnostics free of private data

* fix(agent): retain Sentry details for tool errors

* feat(agent): show tool inputs and failed read attempts

* fix(agent): show individual tool outcomes in activity groups

* feat(agent): explain tool failures in translated tooltips

* feat(agent): name known targets in failed tool calls

* fix(agent): use shared tool errors after rebase

* fix(agent): show interrupted changes, announce tool steps and clear pre-tool text

* refactor(agent): move input previews and failed-call targets out of tool steps

* refactor(agent): log tool-step failures without the Sentry helper

* fix(agent): classify tool errors once and drop partial-failure steps

Calls to tools a reply never offered no longer get a step.

* refactor(agent): key tool presenters by tool name and drop unused step data

Drops presentation_type, the unused card icon, copy-time step cleanup and Kuma-visible chat CSS changes, and defers steps when loading reply history.

* test(agent): cover Stop during a change and merge overlapping step tests

* docs(agent): trim tool presentation guide to the step contract

* fix(agent): keep step facts JSON-safe and polish stopped cards

Restores the JSON check on step facts, keeps a stopped change's title readable at narrow widths, raises its warning contrast, and stops reopening a running reply from re-announcing its old steps.

* fix(agent): cap the Agent chat column at 900px

* fix(agent): name the executing tool call and keep step cards stable while text streams

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(agent): name reused tables and views instead of showing zero created

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(agent): tell the model which changes an interrupted reply started

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(agent): continue a retried tool call on the step of its invalid attempt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(agent): report views skipped by name collisions

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 10:53:05 +00:00
Davide Silvestri ca3d710b3b feat(agent): choose the identity an Agent runs as (#6540)
* feat(agent): choose the identity an Agent runs as

Agents can run as one of the workspace's Agent identities or with no
workspace access. The tools that act with the identity's permissions
come next.

* fix(agent): refresh the run-as identity label

* fix(agent): flag deleted run-as identities in configuration

* feat(agent): explain unavailable workspace identities

* refactor(agent): return a typed configuration object

* fix(agent): handle run-as identity permissions and lifecycle

* refactor(agent): use constants for readiness and state checks

* fix(agent): record before and after configuration values

* refactor(agent): move configuration transaction to API view

* fix(agent): batch run-as identity invalidations

* test: use real debounce in views admin tests

* fix(agent): keep run-as choices within the viewport

* perf: reuse permission data within batches
2026-11-05 09:16:14 +01:00
Davide Silvestri 4cbe4af199 feat(agent-builder): Agents reply to messages (#6466)
* feat(agent-builder): answer messages with background replies

Each message starts a core chat run that streams the configured model's reply and saves it with its turn: status, error code, model messages, usage, and the provider and model that answered. Messages record their author. One reply runs per conversation, and BASEROW_AGENT_MAX_ACTIVE_RUNS_PER_WORKSPACE caps a workspace (default 5). Copies keep turns and authors and end replies still running.

* feat(agent-builder): stream, stop and resume replies in the chat

The chat follows each reply through the core run stream, shows authors, lets the user stop a reply, resumes after a reload or in another tab, and explains replies that did not finish.

* refactor(agent): keep replies focused on chat

* refactor(agent): keep each reply's outcome on its message

A reply is an assistant message created empty with its prompt, and the run
writing it saves its text, status and error code there, replacing the turn
table. Send responses name the run they started, so a reply that ends before
the response is still followed. Retries read the run before the reply, listed
replies that still look unfinished are read again from the primary, and blank
replies are saved empty.

* feat(chat): add shared chat components

Store-free message, markdown, composer and copy button components styled
after the agent builder designs, so the Agent chat and later Kuma can share
one UI. Replies render markdown without images, which could carry
conversation data to any URL, and app links open in the router.

* feat(agent-builder): show replies with the shared chat components

Replies render in place from the conversation history under the agent's
name and avatar, with Thinking and Writing above the composer while they
run, a note when stopped and an error card when they fail. Stop stays
available while a reply runs, even when the configuration stops being
ready.

* feat(agent): hand finished replies to followers and announce reply runs

A finished run carries the saved reply as the messages list shows it, so
followers can apply it without reading the messages again. Conversations
expose the run writing a reply, and agent_conversation_updated carries that
run's id when a reply starts and null when it ends, with the conversation's
updated_on to order them, so every session can show it without requests.
A blank model answer now ends the reply as failed, and replies reuse
ChatRunStatus. Reply permission checks move to the service, sends check the
agent-builder flag, finishing a reply relies on the engine's run lock
instead of a row lock, and the workspace limit defaults to 10.

* feat(chat): share Kuma's typing and loading indicators

Kuma's bouncing dots and reasoning spinner move to core as ChatTyping and
ChatLoading, and Kuma renders them from there with the same look.
ChatComposer's status prop becomes activity and keeps focus on the input
when Send and Stop swap, ChatMessage drops its author props until
conversations can be shared, and markdown leaves mailto and other non-web
links to the browser.

* feat(agent-builder): show reply progress like Kuma and apply replies in place

A reply shows the typing dots until its first text, then a spinner beside
the streaming text. The finished run's saved reply replaces it in place, a
run's start no longer reads the messages, and a streamed chunk re-renders
only the reply being written. Realtime updates set a listed conversation's
run without reading the list again, so its dot pulses grey while it
replies, in every session, and the page drops its chat subscription when no
conversation is open.

* fix(agent): handle empty replies and legacy message retries

* fix(agent): address reply review feedback

* refactor(chat): share response UI with Kuma

* fix(assistant): separate thinking from streamed answers

* feat(chat): share message footers with Kuma

* fix(chat): keep thinking blue and streamed answers expanded
2026-11-03 17:03:13 +01:00