Commit Graph
33 Commits
Author SHA1 Message Date
Peter EvansandJeremie Pardou e4b9a2615b feat: add a shared base for integrations that connect an account through OAuth (#6810)
* feat: add a shared base for integrations that connect an account through OAuth

* fix: keep OAuth account scopes current and bound provider answers

* fix: share parent registration between form APIs

* fix: preserve refreshed OAuth tokens when actions fail

* refactor: use absolute imports for parent OAuth modules

* refactor: decouple OAuth cleanup from application publication models

* refactor: use common import hooks for OAuth connections

* fix: keep OAuth account integrations out of the workspace

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-11-30 08:55:52 +00:00
Tsering PaljorandJeremie Pardou 250748c8dc feat: Workspace level integrations (#6547)
* Add ADR-013 for workspace level integrations

* Add implementation

* Improve context section and remove technical points

* Move bulk replacement point to v2

* Remove workspace-level ownership on import since manual promotion should handle this.

* Add a glossary section

* Do Lazy creation + Celery migration

* Remove demotion

* Tighten the Options considered section

* Add Decision describing where the integrations are managed

* Update implementation plan after changes to ADR

* Sync plan and adr

* Rename adr and implementation

* Add the shared application that owns workspace integrations

* Create the shared application of every workspace

* Let only workspace admins manage workspace integrations

* Let applications use the integrations of their workspace.

* Trash workspace integrations in their workspace.

* Copy workspace integrations into exports and keep them in duplicates.

* Workspace admins can share integrations with every application in the workspace.

* Load the shared application of each workspace in the frontend and keep it out of application lists.

* Manage workspace integrations from an Integrations page in workspace settings.

* Offer workspace integrations in the integration dropdowns of every application.

* Move promoted integrations to the workspace list in other open tabs.

* Let admins make an app's integration available to the whole workspace from its integration settings.

* Preselect a workspace integration for new nodes and data sources when the app has none of its own.

* fix tests

* Delete implementation file

* More fixes after rebase

* Fix tests

* Let builders of an application see and use the workspace integrations from it.

* Show the workspace integrations, read-only, in the integration settings of applications.

* Keep a dashboard's integration out of promotion to the workspace.

* Leave the shared applications out of the admin dashboard's application count.

* Create the shared application of the workspaces made by the fill commands.

* Say in the promotion modal that an integration nobody authorized will run as the promoting admin.

* Say in the promotion modal that undoing it won't make the integration run as the previous person again.

* Ignore integration ids in sample data when publishing copies the workspace integrations an app uses.

* Let only undoing a promotion move an integration out of the workspace.

* Let the shared application backfill stop itself after 5 minutes and skip workspaces another transaction has locked.

* Say in the workspace integrations settings that published applications and workflows keep their own copy until they're published again.

* Leave the shared application out of the assistant evals' application counts.

* Refresh the workspace integrations when the Builder's data, events, users and integrations panels open.

* Say that anything new using a promoted integration blocks undoing the promotion, even from its own application.

* Warn when a database button sends through a workspace integration with no host or token.

* Refuse roles and invitations on the shared application.

* Fix tests

* Show an application only the workspace integrations of types it can use.

* Say in the promotion modal what builders of other applications can do as the integration.

* Leave the shared application type out of the API docs for creating and updating applications.

* Check who receives a workspace integration event in one permission call.

* Say which workspaces have a shared application and who creates it.

* Let a redone promotion record what uses the integration again.

* Update docstrings

* Stop template visitors from listing the integrations of the template's workspace.

* Let database buttons find their own copy of a workspace integration after an import.

* Say what holds the workspace row lock while a shared application is created.

* Fix tests

* Stop the workspace integration form component from being made reactive.

* Make test runs use a new copy of the workflow after an integration it uses changes.

* Hide the Members settings tab from members who can't list the workspace members.

* Add changelog

* Fix migration conflict

* Fix migration conflict

* Fix test

* Update comments and ADR number

* Link to the workspace integrations from the sidebar's Settings menu.

* fix: refresh agent action errors when workspace integrations change

* fix: move workspace integrations into workspace settings

* fix: use share icon for workspace integration promotion

* refactor: use explicit shared application relations

* feat: centralize default integration selection

* refactor: share integration change notifications

* refactor: prepare integration mappings before import

* refactor: collect integration references during export

* refactor: prepare integration ownership changes without a new hook

* test: restore registered service model after mocking

* test: cover shared integration defaults in Builder

* test: include Slack in Agent workspace integration choices

* Fix migrations

* Stop template visitors from listing the workspace integrations through an application of the template.

* Only offer integrations of the user source's integration type when updating a user source.

* Say the workspace integration copy means published Application Builder apps and automation workflows.

* Use the same spacing under both integration settings sections and enlarge their headings.

* Keep the shared application out of automatic snapshot schedules.

* Fix test after rebase

---------

Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
2026-11-27 15:49:32 +04: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 992054e30f feat(agent): suggested messages and public chat appearance (#6874)
* feat(agent): suggest messages to start a conversation with

An agent gets up to four suggested messages, edited in its Instructions.
A new conversation shows them as cards, on the agent's page and on its
public chat, and a click puts the message in the box, ready to send.

* feat(agent): let builders style their public chat page

A public chat gets a font, an accent color, a plain or gradient
background and a "Powered by Baserow" switch, set in its card. The page,
password screen included, uses them; the core chat styles take their
accent from CSS variables so the page only sets the color.

* feat(agent): introduce an empty public chat with its title and welcome text

An empty chat shows a mark in the accent colour, the title, the welcome text and the suggested messages in the middle, like the member chat. The header with the title only appears once a conversation exists.

The welcome text is rendered as markdown on the server, so it no longer appears after the page has loaded.

* fix(agent): fall back to a generic font family on the public chat

A quoted generic family is read as a font name, so the page showed a serif font until the chosen one loaded.

* feat(agent): keep a public chat's appearance on a copy

A duplicated, restored, exported or templated agent's public chat keeps its font, colours, background and Powered by switch. A value from a file that the API would refuse falls back to the default.

* fix(agent): check an imported agent's suggested messages

A file could carry suggested messages the API refuses, and a value that isn't a list broke the workspace's application list. An import now keeps them only when the API would accept them. The copy tests also cover suggested messages and a user template.

* fix(agent): give public chats a neutral default appearance

* fix(agent): label suggested messages and cover when they can be used
2026-11-26 20:42:31 +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 SilvestriandBram Wiepjes 68139d057c feat(agent): add semantic search as an agent action (#6814)
* feat(agent): add semantic search as an agent action

An agent's builder can add the enterprise semantic search service as an
action: the model supplies the query, the builder picks the Local Baserow
integration, table and fields. The search runs with the integration's
authority.

An action type now says whether it changes data. A type that only reads
starts with Ask first off and is never held behind another held call.

Every registered action type is offered, also when the workspace's license
locks it. A locked type shows the upgrade modal instead of being added, and
a locked action can only be renamed, switched or deleted until its type is
usable again. The model never gets a locked action.

* Fixed some bugs

* Run action with workspace identity

* fix(agent): keep a search match whose files or links don't fit

A row whose non-text values took more than the space left could not be cut,
so the result lost it and every row after it. Values that don't fit are now
cut to "…" like texts, so the best match is still read.

* test(agent): cover the semantic search card acting as the run identity

The spec still expected the removed integration picker. It now checks the
form gets the tables the run identity can read, the link to set up workspace
access without one, and the reload when the identity changes.

* fix(agent): don't offer action inputs in search filters

A filter is resolved when the call is sent, without the call's inputs, so
picking an input there only produced a configuration error. A host can now
narrow what filter values read, and the action card offers them none.

* refactor(agent): name the workspace check of an action type is_usable

available_action_types now lists the locked types too, so is_available named
the opposite of what it returned for them.

* refactor(agent): one limit on what the model reads of an action result

HTTP request and semantic search each defined the same 20,000 characters.

* refactor(agent): drop what the integration picker of actions needed

No action wraps its form anymore and Agents no longer hold Local Baserow
integrations, so the presenter hook and the test changes for them go.

* docs(agent): actions on Baserow data act as the Run as identity

State the rule for every action whose service reads or changes Baserow data:
no integration to pick, permissions on the identity alone. Actions on other
services keep their integration. Drop the integration and form wrapper parts
that no longer hold, and say how to bound a result.

* fix(agent): log why a tool or run failed in debug mode

Tool, preview, step, web fetch, trigger message, MCP and chat run failures
logged only the exception class, so a failed semantic search showed nothing
but its name. They now share the reply's helper, which adds the exception
text in debug mode.

---------

Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
2026-11-24 19:37:22 +00: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
alamin-br fc1131bc62 feat(agent): support Agents in templates and import/export (#6789)
* feat(agent): skip Agents when importing with the feature flag off

* feat(agent): use an enabled model when an imported Agent's model isn't available

* feat(agent): keep an imported Agent's tool choices until an identity is picked

* feat(agent): tell the editor an imported Agent's tools turn on with an identity

* feat(agent): let template previews read an Agent's configuration

* feat(agent): show Agents in the template preview

* fix(agent): check the configuration permission when copying an Agent into a user template

* fix(agent): let signed out visitors preview an Agent in a template

* fix(agent): sync a template again once its Agents can be imported

* fix(agent): make an installed Agent's data-changing tools ask first

* fix(agent): list only MCP servers as connected apps in the template preview

* test(agent): cover blank imported models and duplicates without their identity

* fix(agent): keep pending tools when tools are saved without an identity

Tools stay off without an identity, so a full-config save from an API client
shouldn't throw away the choices an imported Agent is waiting to apply.

* fix(agent): fail a template install when every application is left out

With the agent builder flag off, a template holding only Agents installed
nothing yet reported success and counted the install.

* fix(agent): say why a template with nothing to install fails

"The content of the template was removed" sent people looking for a broken
template when the real cause is a feature turned off on this instance.

* docs(agent): say a user template copy refuses an Agent the owner can't read

* fix(agent): import Agents for users granted the flag

Feature flags can now be granted per user, so the import checks the user it's for instead of only the instance.

* fix(agent): sign up with a template of only Agents while their flag is off

The signup install raised TemplateHasNothingToInstall and returned a 500 without creating the account.

* fix(agent): refuse a user template when none of its applications can be copied

An owner without the Agent flag got an empty template that no one could install.

* fix(agent): refuse a user template that would leave out a selected Agent

A mixed selection lost its Agents without notice, and every update lost them again.

* fix(agent): skip templates with nothing to install in fill_workspaces

* fix(agent): name the applications a user template can't copy

The job failed with a generic message, and checking before the copy creates nothing.

* fix(agent): don't offer hidden applications to export or save as a template

Agents without their feature flag were listed, so Select all always failed.

* chore(agent): log the templates fill_workspaces skips

* fix(agent): filter pickers by type availability, not by permissions

Permissions can load after the update form preselects, which dropped builders and automations.

* fix(agent): keep the count check after a user template copy

* fix(agent): don't count unusable applications as template content

* fix(agent): import Agents whatever the importer's feature flags

A user's early access must not change what an import saves. Agents are
now kept by template sync, template installs, user template copies and
workspace file imports, so someone who gets the flag later finds them
with their configuration. Also moves is_template_storage after the
existing ImportExportConfig fields, so positional arguments keep their
meaning.

* fix(agent): hide Agents in template previews and install toasts without the flag

The preview opens another application when the preferred one is a hidden
Agent, and the install toast links to the first application the user can
see.
2026-11-20 13:57:09 +00:00
Davide Silvestri cc361e6658 feat(agent): create agents with a setup wizard (#6765)
* feat(agent): create agents with a two-step setup wizard

The create modal asks for a name and what the agent should do, then reviews
instructions, how it starts, the identity it acts as, permissions and extras.
The choices are applied through the endpoints Configuration uses; a choice
that can't be applied is reported and the agent still opens.

The Run as dropdown can also create an identity. Application types supply
their create modal through getCreateModalComponent.

* feat(agent): add tools, model and identity choices to the create wizard

The wizard gains a third screen for the provider, model, reasoning effort and
web search. Review can create an identity and pick tools one by one. Each
suggestion now fills the whole setup: how the agent starts, its schedule,
permissions, web search and actions.

A new endpoint lists the tools an agent created in a workspace can be given,
so they can be picked before the agent exists. The provider, model and effort
fields are one component shared by Configuration and the wizard.

* fix(agent): choose the wizard identity role from workspace tools

* fix(agent): address create wizard review

Skip locked tools in the permission presets, create the identity before
the agent so a rejected name stops the wizard, number suggestion names,
select the prefilled name, report models that can't search the web, show
a failed tools request and fix the Read only icon.

* fix(agent): address second create wizard review

Give a new identity Builder when the agent may change data, reuse the
identity a failed create made, explain why web search stays off and pass
the workspace to the tool picker.
2026-11-20 14:32:37 +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
alamin-brandMohammad Al Amin a63ff419a2 feat(agent): let agents open web pages with any model (#6766)
* feat(agent): let agents open web pages with any model

Co-authored-by: Mohammad Al Amin <alamin.baserow@gmail.com>

* fix(agent): open web pages through Baserow's HTTP stack and report failures

Failed fetches ended the whole reply, showed as invalid input, and files were stored whole.
Pages now go through the integration HTTP limits, only text is opened, and a reply opens at most five.

* fix(agent): leave scripts out of opened pages and bound their titles

Script and style text made up most of what the model got from many pages.

* fix(agent): refuse internal addresses when opening pages

The model picks the URL and a page can steer it, so the setting that lets integrations reach internal services shouldn't apply.

* fix(agent): read opened pages more safely

A crafted page could still end the reply, files sent as text were read, and pages without a charset came out garbled.

---------

Co-authored-by: Mohammad Al Amin <alamin.baserow@gmail.com>
2026-11-18 23:01:30 +01:00
Davide Silvestri d21801281f feat(agent): trigger agents when rows are created, updated or deleted (#6695)
* feat(agent): trigger agents when rows are created, updated or deleted

* test(agent): find the trigger picker by the class it now has

The trigger picker renders the shared service picker since the send
email actions, so its menu is under .agent-service-picker.

* fix(agent): check a trigger's access again before its conversation starts

The task that starts a firing's conversation trusted the access check made
when the event happened. A run identity removed, trashed or without access
by the time the task ran still got a conversation with the event's rows.

* fix(agent): apply the row trigger review fixes

- A type change moves an overlap rule left at the old type's default to
  the new type's default.
- Queued replies wait while the run identity can't read what the trigger
  watches.
- An imported formula is kept as written when no path is remapped,
  through one import_formula in core.
- Row events hand their listeners services holding the event's table.
- Trigger form choices no longer read the workspace's views.
- A first row too long for a message is cut short instead of left out.
- A no-access error for a type the card no longer shows is ignored.
- The dispatcher no longer clamps the batch size.

* fix(agent): keep the merged trigger behaviour and UI for row triggers

- Skipping stays the default overlap rule: only the row trigger types say
  their events can't be skipped, so HTTP and periodic triggers start as
  they did before.
- The workspace-access note is a plain alert and the batch size field is
  spaced like the hosted forms, without style overrides.
- The type-change and queued-firing tests are develop's again, with the
  row trigger tests added after them.
- ADR 014 names the hooks row triggers add to the shared service type.

* fix(agent): show a row trigger without workspace access as misconfigured

The trigger can't run until the agent has workspace access, so its card
gets the error icon with a tooltip and the database field shows the error,
instead of an info note.
2026-11-17 23:42:51 +01:00
Davide Silvestri b566941058 feat(agent): start runs from HTTP webhooks (#6737)
* feat(agent): start runs from HTTP webhooks

* fix(agent): address HTTP trigger review feedback

- Add opt-in agent trigger types that adapt a shared trigger type
- HTTP: exclude GET by default and drop the workflow response settings
- HTTP: raw body is the default message and the text of an unset one
- A message with no text says when the trigger fired, not the payload
- Forms take hiddenFormFields from their host
- Trigger cards collapse and no longer resize while saving
- Keep the HTTP trigger uid out of exports without sensitive data

* feat(agent): make trigger and action card headers consistent

- Chevron on the left of action cards, as on trigger cards
- "Enabled" label above the switches, on the Expand all line
- Switch tooltip says the state and what a click does
- No divider under an action card's name
2026-11-17 17:14:52 +01:00
Davide Silvestri 3460fd301f feat(agent): change a trigger's type and name row trigger services (#6704)
* feat(agent): let a trigger change its type

* feat(integrations): name row trigger services after their table

* feat(agent): change a trigger's type from its card

* chore(agent): name a read-only trigger's type box after its type

* fix(agent): keep trigger type changes consistent

* fix(agent): keep trigger validation and type changes consistent
2026-11-16 16:54:31 +01:00
Davide Silvestri 26ff58a3d9 feat(agent): let agents send emails through configured actions (#6720)
* feat(agent): add configurable send email actions

* fix(agent): send what an action call showed and harden actions

Review fixes for the send email action.

- Resolve an action call's formulas once and carry the values from the
  held call to its dispatch, so the approved preview is exactly what is
  sent. DispatchContext.resolved_values lets a dispatch skip resolving
  the formulas of that service again.
- Deny an approved call when its integration changed, or when it comes
  back without the values its approver read.
- Let the AgentActionType base own configuration checks, preview and
  dispatch. A type only supplies its defaults and readable values.
- Reserve the mcp<number>_ names of connected app tools, and accept any
  valid input name, run_ctx included.
- Keep whole numbers whole in Number inputs.
- Add BASEROW_AGENT_MAX_ACTIONS_PER_AGENT, unset by default, and load an
  agent's actions in a constant number of queries.
- Order and label an action's fields from its presenter in the step
  card and in configuration errors.
- Replace the plan with docs/development/agent-actions.md.

* fix(agent): show what a saved action returns and drop undone errors

- A debounced save updated a copy the action card doesn't render, so the
  configuration errors the server found never showed. Save through the
  object the list renders.
- Clear a rejected edit's error once the edit is undone.
- Word the action limit so it also reads well with a limit of one.

* test(database): update decorator tooltip snapshots for edge-aware tooltips

The tooltip directive now keeps top and bottom tooltips inside the
viewport and positions their arrow, which changes the inline style the
two decorator tooltip snapshots record.

* fix(agent): mark an action formula with a refused argument as invalid

A function's argument check raises Django's ValidationError, which the
readiness check let through. A formula like minus('abc', 1), stored by
an import, then failed the action list, the configuration and every
reply instead of showing the action as misconfigured.

* fix(agent): start an email action on the instance server only if it delivers

The starter asked the looser question the builder and automations use,
while the readiness check asks whether a message is delivered. With a
backend that only prints, a new action opened on the instance server
and was unavailable straight away.

* fix(agent): name a deleted action in the trash

* fix(agent): read a negative agent limit as no limit

A limit of -1 was kept as a limit, so nothing could be added: no action
with BASEROW_AGENT_MAX_ACTIONS_PER_AGENT, no reply with
BASEROW_AGENT_MAX_ACTIVE_RUNS_PER_WORKSPACE. Both now treat 0 or less
as no limit, like the trigger caps.

* feat(agent): ask first by default before an action runs

A new action sent as soon as it was added, so anyone chatting with the
agent could have it email any address. Built-in tools that change data
and MCP tools already start with Ask first on; every action now does
too, at the model level so the next action types inherit it.

* fix(agent): tell the approver's own session when "Always allow" applies

Approving with "Always allow" turned Ask first off on the server, but
the realtime event skipped the approver's session as if it had edited
the action itself. The Actions card kept showing Ask first on while
emails went out. No session made this edit, so every session is told.

* fix(agent): show an action call in full to whoever approves it

The approval preview kept 10 recipients and 1,000 characters while the
call sent everything. An action's step now shows every value, never
shortened. Limiting what a call may send is left to a follow-up.

* fix(agent): apply every action event a reconnect replays

Action events all write to one slot of the agent, and the watcher only
saw the last value of a tick. A reconnect replays what it missed in one
loop, so an action another user created was lost when a later event
followed it. The watcher now runs on every write.

* fix(agent): reload the configuration when the agent gains or loses an action

Actions count as tools for web search, but nothing refetched the
configuration when one was added, switched, repaired or deleted, here
or by another user. On a model that can't search while it uses tools,
the web search setting stayed stale until a reload. The Actions section
now emits the reload other sections already use, only when the agent
gains its first callable action or loses its last.

* docs(agent): leave the limits of a call to its action type

What a call may send and what its preview shows is for each action type
to limit. Send email limits neither yet.

* fix(agent): mark a stored formula that can't be checked as invalid

A formula nested too deeply raised RecursionError in the readiness check,
so listing the actions, the configuration and every reply failed. Any
failure to check a formula now marks its field as invalid, as a stored
formula can make the parser or a function's own check raise anything.

* fix(agent): keep an approval when its integration is renamed or moved

The approval key digested the whole exported integration. Its name and
its place in the list don't change where a call is sent, and the place
of every integration can change when another one is added or moved.

* fix(core): keep the custom scrollbar in WebKit browsers

Since Chromium 121 the standard scrollbar properties replace the
::-webkit-scrollbar rules, so the rich text editor lost its 10px thumb.
The standard properties now only apply where those rules don't exist.
Stylelint is told that a mixin's body ends up inside a rule.

* chore(agent): name the collapse-all button after its block
2026-11-16 14:41:41 +00:00
Davide Silvestri 9af8a8422e feat(agent): rate-limit agent triggers and let a busy trigger skip or wait (#6672)
* feat(agent): rate-limit agent triggers and let a busy trigger skip or wait

* feat(agent): choose a trigger's overlap rule and show skipped firings

* feat(agent): let a trigger run its replies in parallel

A third overlap rule, Run in parallel, starts up to
BASEROW_AGENT_TRIGGER_MAX_PARALLEL_RUNS replies at once (default 5) and
queues the rest up to the queue cap. Skip, Wait and Parallel now share one
rule (OverlapLimits): start while there is room to go and nothing is
queued ahead, queue while the queue has room, else skip. A firing held
back by the workspace's run limit queues where the rule queues. The
hand-off and the sweep start as many queued replies as fit.

* test(agent): pin the trigger lock order a hand-off and a builder's save rely on

* fix(agent): lock agent before firing its trigger

* fix(agent): tighten trigger overlap counts and limit parsing

- A reply in a trashed conversation no longer counts as going, so it
  can't block a trigger until the trash is emptied.
- A message that fails to resolve fails its reply before the overlap
  rule, so the builder sees it instead of a skip.
- The hand-off locks only the queued replies that can start.
- Rate-limit pairs must be positive integers.
- The API help text describes `parallel`.

* fix(agent): hand a trigger's queue on in its own task

- When a trigger's reply ends, a task started with the trigger's id
  starts its queued replies, instead of the ending reply's save doing
  it. With the broker down, a hand-off fails at most one reply instead
  of the whole queue, and the reply's save no longer loads the trigger.
- The hand-off and the sweep check what a firing checks: Agents on, the
  trigger type available and the agent ready. A trigger that can't fire
  keeps its queue until it can.
2026-11-13 17:38:50 +01: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 4ad9b01319 feat(agent): set up agent triggers in When it runs (#6693)
* refactor(core): read service results and trigger timezones through the service type

* feat(agent): add named agent triggers with their API

* feat(integrations): name and describe periodic trigger services for any consumer

* feat(agent): configure triggers in the When it runs section

* docs(adr): record agent triggers and shared conversations

* fix(agent): save a trigger switch alone after a rejected save

* fix(agent): audit only trigger messages that change and translate trigger actions

* perf(agent): load trigger services in bulk when listing triggers

* fix(agent): resolve trigger dates in the trigger's timezone, drop the duplicate schema and unnamed trash names

* fix(agent): save each trigger field alone and show reverted service values in the form

* fix(agent): offer to add a trigger only once the trigger list has loaded

* fix(agent): stop nesting trigger service forms inside the configuration form

* refactor(builder): read data source and previous action results through the service type

* perf(agent): look up a trigger's type only when its service values change
2026-11-12 22:55:05 +00:00
Davide Silvestri 84dc609565 feat(agent): improve the conversation list (#6683)
* feat(agent): improve the conversation list

* fix(agent): align the always-allow button height

* fix(agent): shorten multi-tool approval labels

* adjust page size to fit the conversation list

* fix(agent): keep pins on form renames and send pinned conversations

Validate the conversation PATCH body as partial, so a form-encoded rename
no longer unpins. Update events carry the whole conversation, so other
tabs can list a conversation pinned outside their loaded pages. Drop the
owner index that the pinned-first ordering no longer uses.

* fix(agent): place conversations instead of re-reading the list

One rule decides whether a conversation is listed: it matches the filter
and falls within the loaded pages. Only the server's 404 or delete event
removes a conversation, so a reload after a missed unpin keeps the open
conversation and its draft. Pin events and pin responses no longer read
the list again, and a hidden open conversation that is deleted selects
the one after it.
2026-11-12 17:33:38 +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
alamin-br 2e9746068d feat(agent): let Agents use tools from MCP servers (#6664)
* feat(agent): call tools of remote MCP servers (POC)

Agents can use tools from external apps through MCP servers that an editor adds and reviews.

* feat(agent): connect apps and review their MCP tools (POC)

Editors add MCP servers to an Agent, pick which tools it may call, and see those calls in chat.

* fix(builder): skip integration events for apps without an integrations list

Creating an MCP server on an Agent raised a TypeError toast, because Agents keep no integrations in the store.

* feat(agent): sign in to MCP servers with OAuth (POC)

Popular hosted MCP servers (Linear, Notion, Airtable, Atlassian, Sentry) only accept OAuth sign-in.

* feat(agent): say when an MCP server refuses the key, and require it

A wrong key showed as an unreachable server and an empty tool list.

* fix(agent): bind MCP sign-in to its editor and harden the MCP client

A sign-in link opened by someone else could connect their account to the server.
A provider outage disconnected accounts, and bad tool lists failed or looped.

* feat(agent): copy MCP servers and their tool choices with the Agent

Duplicating or exporting an Agent dropped its connected apps.

* fix(agent): don't ask for an MCP credential the server no longer uses

Switching away from an API key, or replacing a client Baserow registered,
blocked URL changes until a credential nobody had was entered.

* fix(agent): refuse an MCP sign-in when the server changed meanwhile

Moving the server during sign-in made the callback fail with a 500.

* fix(agent): give each MCP exchange an overall deadline

A server sending a little at a time could hold a web worker or a reply forever.

* fix(agent): tell the model what the MCP server answered when a call fails

Invalid arguments and a refused key were reported as an unreachable server,
so the model couldn't fix its call or explain the problem.

* fix(agent): refresh MCP tokens that come without a lifetime

Such a token was never refreshed, so the app stopped working once it expired.

* fix(agent): start imported MCP tools off until reviewed

An export file or template could turn on tools of an app nobody here reviewed.

* fix(agent): hash imported MCP tools from their imported definition

A file could carry a reviewed hash for a definition the server never had.

* fix(agent): only approve the MCP tool definition the editor reviewed

A tools list left open across a refresh could turn on a changed tool unseen.

* fix(agent): bound MCP OAuth requests and expire tokens without a refresh token

A slow token endpoint held the row lock and a reply indefinitely.
An expired token with nothing to refresh it still showed the app as connected.

* fix(agent): drop MCP tools fetched from a server that was moved meanwhile

A refresh racing a URL change stored the old server's tools on the new one.

* fix(agent): let only the editor use up an MCP sign-in, once

Another user's attempt voided the editor's sign-in, and two requests at once
could both exchange the code.

* fix(agent): only copy connected apps the copier may read

A duplicate carries the app's key, so a role that can't read the app shouldn't get it.

* fix(agent): say when the browser blocks the MCP sign-in window

A blocked popup showed a backend 'not connected' error instead.

* chore(agent): remove unused needsReview from the MCP servers composable

* fix(agent): hash MCP tool titles as stored

A copied tool with a title over 255 characters never matched its server again.

* fix(agent): forget the old refresh token on a new MCP sign-in

Signing in as another account could later switch back to the first one.

* fix(agent): wait for a URL change in flight before storing MCP tools

An unlocked read let a refresh store the old server's tools on the new one.

* chore(agent): drop a CancelledError clause that never applies

* fix(agent): review an MCP server's tools after its URL changes

A moved server's new tools were listed off with no review prompt, and clearing
your own client id asked for a secret that would be thrown away.

* fix(agent): always tell the opener how an MCP sign-in ended

An unexpected error left the sign-in window on 'Connecting' and the opener waiting.

* chore(agent): give the removed MCP tool modifier its base class

* fix(agent): keep MCP credentials out of object reprs

A reply's request object printed the server's key in error reports and logs.

* fix(agent): use the current secret of an editor's own MCP client

Adding a secret later kept the old 'no secret' method, so refreshes failed and
the app disconnected.

* fix(agent): don't store MCP tokens for a server moved during sign-in

A URL saved while the provider answered got the old server's tokens, which then
went to the new server.

* fix(agent): clear only the expired MCP token, not a newer sign-in

A reply clearing an expired token could undo a sign-in that had just finished.

* docs(core): note that Agents also narrow imported integration types

* fix(agent): give MCP tools with clashing model names a distinct name

A second tool whose name matched another after the 64-character cut was dropped
while still shown as on.

* fix(agent): send a registered MCP client secret when the server doesn't say how

RFC 7591 defaults to Basic auth; sending nothing made every sign-in fail.

* fix(agent): try the next OAuth metadata URL when one can't be reached

One unreachable candidate ended discovery although the others would answer.

* fix(agent): read only the headers of the MCP OAuth discovery probe

A server streaming its initialize answer made sign-in time out.

* fix(agent): keep a registered MCP client registered when its id is sent back

Writing back the same client id turned Baserow's own client into an editor's one.

* fix(agent): ask for the OAuth client secret in its own words

The error talked about a header, which the OAuth form doesn't have.

* refactor(integrations): move MCP serializers and errors to their own modules

Matches the layout of the other API modules.

* fix(agent): count MCP tools when deciding whether web search fits

Gemini 2.5 can't combine search with function tools, and MCP tools are function tools too.

* fix(integrations): require https sign-in endpoints for https MCP servers

The MCP authorization spec requires it, and the code, refresh token and client secret would otherwise go out in clear text.

* fix(integrations): send an editor's MCP client secret with Basic auth

RFC 6749 makes Basic the method every server supports; the body form is only used when the server lacks it.

* fix(integrations): say when an MCP server doesn't use OAuth

Starting a sign-in for it answered that the integration doesn't exist.

* docs(integrations): document the MCP OAuth helpers

* fix(integrations): only use MCP OAuth tokens with the connection they belong to

A sign-in or refresh racing a move or a disconnect could store or send one server's tokens to another. A generation on the server now ties each sign-in to its connection.

* fix(integrations): don't ask for an MCP credential the change drops anyway

The form had to predict which empty secrets to send around the check; it now sends only what the editor changed.

* refactor(integrations): let integration types mount their own API urls

The MCP endpoints were mounted by the Agent application type.

* fix(integrations): limit the size of MCP and OAuth responses

One Agent's server could make a shared worker load any amount of data. Uses the HTTP request integration's limit.

* feat(integrations): audit MCP tool and account changes and send them to other editors

They changed the integration outside its update action, so they weren't logged and other editors only saw them after a reload.

* fix(agent): keep MCP servers in the integration store and match each sign-in to its result

Other editors' changes now arrive live, late answers no longer land in a modal opened since, and a sign-in finishes even when the provider cuts the popup off. The review also shows each tool's parameters.

* fix(integrations): register with MCP servers when Baserow runs on this machine

An authorization server can't fetch a client metadata document from localhost, so signing in failed on local https instances.

* style(agent): format the connected apps test

* fix(integrations): keep MCP OAuth tokens with their issuer, lock like integration updates, audit before notifying

A zero lifetime now means expired, a new issuer or client drops the old account,
and MCP locks only the integration row so PATCH can't deadlock with them.

* fix(agent): don't run MCP writes that follow a held call

They can't wait for approval yet, so they're refused until the held call is decided.

* fix(agent): keep MCP tool picks with the definition they were made for

Another editor's refresh could re-enable a changed tool, and a new tool crashed the
list. The review now also shows each tool's full input schema.

* fix(agent): scroll the MCP tools modal, not its list

The list had its own scrollbar inside the modal, and the checkbox labels showed cut off in the narrow columns.

* feat(agent): take whether an MCP tool changes data from the server

Editors had to answer it for every tool, and every tool started ticked. The server's read-only hint answers it; a tool without one still counts as changing data.

* feat(agent): ask first before calling MCP tools

MCP tools act with the server's own credential, so editors need the same Allow / Ask first choice as for workspace tools. An approval only holds for the server, account and tool definition it was given for.
2026-11-11 17:47:17 +01: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
alamin-br e12874b966 feat(agent): choose the reasoning effort an Agent replies with (#6641)
* feat(agent): choose the reasoning effort an Agent replies with

Some requests need the model to think harder, others need fast, cheap replies.

* fix(agent): send the lowest effort for Off on models that always reason

Always-reasoning models ignore False and reasoned at their default effort; unknown saved values now keep the default instead of failing the reply.

* fix(agent): send only reasoning efforts the model accepts

Pro models reject some efforts, so each provider type now picks the next accepted one
and the settings explain when replies use another effort or the model default.
2026-11-09 14:53:33 +01:00
alamin-br d59e412bf3 feat(agent): add native web search (#6628)
* feat(agent): add native web search setting

Agents can answer from current web pages using the search built into their model provider. Off by default because searches cost money and can leak data when combined with workspace tools.

* fix(agent): stop retrying searches once a reply reaches its limit

Newer Claude models report the limit only inside their filtering code, so they kept retrying for minutes with nothing on screen.

* fix(agent): let Anthropic enforce the reply's search cap

Searches run from filtering code escape max_uses and continuations reuse the tool,
and Anthropic already counts earlier requests of the reply, so plain search with a
fixed cap is the only one it enforces.

* fix(agent): show when a reply could not search instead of having the model say so

A 400 doesn't prove the model can't search, and an SDK that excludes search
would fail the whole reply.

* refactor(agent): match step events by pattern

* feat(agent): mark web search as unavailable beside its switch

A saved setting the chosen model can't use looked on until you read the text under it.
2026-11-09 14:00:57 +01:00
Davide Silvestri e4891ee030 feat(agent): rename and delete conversations (#6595)
* feat(agent): rename conversations and move them to the trash

Owners rename a conversation with PATCH and delete it with DELETE on
/agent/<id>/conversations/<uuid>/. A deleted conversation goes to the
trash as an owner-only entry and its running reply is cancelled. Renames,
deletions and restores reach the owner's other sessions in realtime.

* feat(agent): rename and delete conversations from the list

Each saved conversation gets a menu with Rename, inline in the list, and
Delete, which selects the next conversation and offers a restore toast.

* feat(agent): undo and redo conversation renames and deletes

* fix(agent): avoid deadlock when deleting a conversation mid-run

* refactor(agent): name the reply activity event after what it reports

agent_conversation_updated becomes agent_conversation_activity: it tells the owner's sessions that a reply started or ended, or that a conversation came back, so the update name is free for changes to a conversation's own values.

* refactor(agent): update conversations through one generic action

Rename becomes UpdateAgentConversationActionType, which takes the values to change (for now the title) and records their original and new values, so later attributes such as pinning reuse the same action, endpoint and agent_conversation_updated event. Views run the conversation actions through the action registry.

* refactor(agent): run Agent API actions through the action registry

* fix(agent): keep deleted conversations private when their owner is deleted

Removes the owner's conversation trash entries before the user is deleted, since an ownerless entry is listed to every member with its title. A reply ending in a deleted conversation no longer makes the owner's lists re-read, and permanent deletion and duplicates are covered by tests.

* fix(agent): make conversation rename and delete robust across sessions

The menu uses MenuList so its actions work from the keyboard, and focus returns to the conversation after a rename. A delete re-reads the first page so Load more skips nothing, list reads that a delete or update outdated are read again, an untouched rename sends nothing, a conversation deleted elsewhere is dropped instead of failing, and an input method's Enter no longer saves early.

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

Tests reach every action through action_type_registry, as the views do, so an unregistered action type fails them.

* fix(agent): use the app's standard context menu for conversations

Rename and Delete use the same context menu markup, classes and icons as the other menus in the app.

* fix(trash): keep other users' private items when emptying the trash

* fix(agent): lock renamed conversations and skip replies in trashed ones

* feat(agent): page conversations with a cursor

* fix(agent): page conversations by cursor and keep deletes and renames during requests

* fix(agent): keep the loaded conversation pages consistent with realtime changes

Activity events carry the conversation, so a restored or remote one is
listed when it falls inside the loaded pages without reading the list.
Only the first read and Load more move the cursor. A reconnect reads the
loaded pages again and drops conversations deleted meanwhile.

* fix(agent): keep the conversation being renamed in place

Chrome blurs a focused input the list moves, which saved a half-typed
title when the conversation got activity during the rename.
2026-11-06 16:28:40 +01:00
Davide Silvestri 66053dd058 feat(agent): Agents use the database tools as their identity (#6543)
* feat(agent): Agents use the database tools as their identity

Each Agent has an allow list of the shared database tools, read tools on
for new Agents. A reply offers the enabled tools while the Run as identity
is usable and runs them as that identity. Table and view creation now work
for actors that aren't users.

* feat(agent): choose an Agent's tools in its settings

Workspace access gets a Workspace tools switch with Everything, Read only
and Custom presets, and a tool permissions modal that allows each tool.
The configuration lists the tools an Agent can be allowed to call.

* fix(agent): retry invalid tool calls and name the allowed tools

- Rename AgentTool to AgentAllowedTool and the API field tools to
  allowed_tools; the migration becomes agent.0007_agent_allowed_tools.
- Pin every tool name and whether it changes data, since Agents allow
  tools by name.
- Let the model correct up to 3 invalid calls in a row per tool instead
  of failing the reply after the second.
- Move the actor language helper to core user utils, so TableHandler is
  traced again.

* fix(agent): secure tool execution and improve permission controls

* fix(agent): disable workspace tools without a run-as identity

* polish and cleanup

* fix(test): isolate admin view search fixture IDs

* fix(agent): address tool execution review feedback

* fix(agent): make workspace tool access explicit
2026-11-06 09:35:18 +01: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
Davide Silvestri 6a069378ff feat(agent-builder): save private Agent conversations (#6371)
* feat(agent): save private Agent conversations

Adds private conversations: members start or continue a conversation by
saving user messages, with idempotent retries and per-owner privacy.
Sending waits for a ready configuration. Duplicates and snapshots keep the
conversations; portable exports and templates leave them out.

* fix(agent): keep conversation drafts across token refreshes

The conversation page reset itself whenever a token refresh reassigned the
user; it now watches the Agent and user ids by value. A narrow Agent column
lets the list shrink so the chat and Send stay visible, a message the
server rejects becomes editable again, the send error is announced to
screen readers, and the conversation endpoints are described in the API
schema.

* fix(agent): focus the composer when starting a conversation

Clicking New conversation now focuses the message input, so typing can
start right away.

* fix(agent): sync private conversations without losing drafts

Invalidate only the owners other sessions after committed content changes, then refresh through the regular application update path. Merge messages in API order and keep drafts, composer focus and reading position during concurrent reads and sends. Reuse shared loading and button controls.

* fix(agent): align conversation layout with builder designs

* fix(agent): address conversation review feedback
2026-10-23 14:04:15 +02:00
Davide SilvestriandBram Wiepjes 72760990c5 feat(agent-builder): configure Agent instructions and model (#6415)
* feat(agent): configure Agent instructions and model

Adds the Agent settings fields, readiness and configuration endpoints, an
autosaving configuration sidebar and the settings permission. Settings are
copied with the Agent and exported only by members who can read them.

* test(agent): share Agent page setup and mock helpers

Both page specs reuse one setup and one-line route mocks, and API tests share
an authenticated client.

* fix(agent): lock parent before configuration updates

* fix(agent): limit model availability checks to settings readers

* refactor(agent): read Agent readiness from the application

Readiness travels with the application payload instead of a separate
readiness endpoint, so the page load and realtime updates keep it current.

The configuration form also stays stable while editing. It no longer
reloads on unrelated application updates, saves text fields on blur and
selections on change, restores a blank name instead of blocking
navigation, keeps the current Agent selected when the save before a
switch fails, and ignores re-selecting the current provider. The export
permission test now goes through ExportApplicationsActionType.

* fix(agent): tighten the Agent configuration API

The configuration endpoint now serves only instructions, provider and
model behind agent_application.read_configuration, which saving also
requires. Renames go through the standard application update, the views
return their declared serializers, the length limits come from the model,
and the endpoints are documented in the API schema.

* fix(agent): rename through the application and fit the assistant panel

The configuration sidebar renames the Agent through the regular application
update, follows the Agent column width with container queries, offers
Retry first without an empty actions row, keeps its focus outline on its
own buttons, and names an unavailable provider. The first load starts on
mount, and the specs mount with a route record and find fields by label.

* fix(agent): keep configuration edits across token refreshes

The page reset itself whenever a token refresh reassigned the user, because
the watch compared a new array each time; it now watches the Agent and user
ids by value. The configuration payload names its readiness `readiness`,
like the application payload, and the redundant readiness tests are gone.

* fix(agent): explain configuration section errors

* fix(agent): address configuration review feedback

* refactor(agent): reuse shared menu and button components

* fix(agent): align sidebar separators and back control with design

* fix(agent): match sidebar close control to design

* Remove name input loading spinner and added newline

* remove double validation

---------

Co-authored-by: Bram Wiepjes <bramw@protonmail.com>
2026-10-23 09:12:13 +00:00