Skip to content

Approve a proposal with corrected arguments - #74

Merged
icaliman merged 2 commits into
mainfrom
approval-form
Nov 25, 2026
Merged

icaliman merged 2 commits into
mainfrom
approval-form

Conversation

@icaliman

@icaliman icaliman commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

When one argument of a proposed write is slightly off (a time, a quantity, a typo in a name), the only way out today is Reject and a new message, which costs a turn and often comes back wrong in another field. filament-agents#108 asks for a form on the approval card; this is the engine half, with no Filament in it.

Approve with corrected arguments (packstub/filament-agents#108)

  • AgentChat::decide($call, true, $arguments) replaces the proposed arguments key by key and the turn runs Decision::edit() (in laravel/ai since 1.0). laravel/ai writes the edited arguments to the stored call, so the transcript, the card and the model's next reply all see what ran.
  • Arguments are taken from PHP only: the chat's act/decide endpoint never passes any, so nothing skips the form's validation. A call not waiting in that chat starts nothing; a rejection ignores them; arguments equal to the proposal approve as proposed.
  • A held decision (two proposals of one answer, decided one at a time) keeps its corrections until the other one is in; deciding the same call again replaces them, so an approval made without corrections never runs with earlier ones.
  • The tool log keeps what the model proposed in arguments and what ran in the new approved_arguments; ProposalDecided gets $approvedArguments.

A host can draw the decision

Packstub\Agents\Chat\ApprovalForms is an optional interface beside ChatHost (so the existing contract does not change): approvalView($tool) names a view that replaces Approve and Reject for that proposal, under the question. The chat listens for an agents-decided browser event with the turn (ChatView::turn(), the same payload its own actions answer with) and follows it, as it does after its own decide.

Upgrading

Run php artisan migrate (adds approved_arguments to agent_tool_calls; the create migration has it too for fresh installs).

Docs

docs/tools.md: "Correcting the arguments before approving".

Tests

ApprovalEditsTest: the edited run and both sets of arguments in the log and the event, unchanged arguments, a call that is not waiting, a rejection, a held decision and one decided again, the turn payload, the HTTP endpoint ignoring arguments, and a host's approval view replacing the buttons. Full suite 172 passing, Pint clean, resources/dist rebuilt. The filament-agents PR passes its suite against this branch.

@icaliman
icaliman merged commit fab8214 into main Nov 25, 2026
14 checks passed
@icaliman
icaliman deleted the approval-form branch November 25, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant