Commit Graph
15 Commits
Author SHA1 Message Date
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
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
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
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 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 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 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
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 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 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