Repository navigation
feat(automations): ask the model, use an assistant tool, ask the agent - #438
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CyjR2zEfmTXBewKAx9Taw5
This was referenced Oct 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Adeel · project thread
Description
Before: automations could only log a line or send a message; nothing let an automation use the model or the assistant's tools.
After: the AI group of actions (workflow studio M7):
ask_model: asks the model aprompt(optionalsystem,model); withjson_schemathe reply is that object, so later nodes read{{ steps.n3.date }}.call_tool: calls one of the assistant's tools withargsand passes on its result, summary and any approvals it made.ask_agent: hands what happened (about, by default{{ event }}) to the assistant's tool loop withinstructions, limited to sometoolsif given, for up tomax_stepsrounds (6, at most 12). The exchange is saved as a conversation of the person's, titled ": ", so they can open it and approve what it proposed. Output{answer, chat, approvals, steps}.All three are effect
read, because the Toolbox asks for every change itself. While an automation runs, nobody is reading along, so its Toolbox (actions_ai.Box):remember.It acts as
automation:<id>with the person's permissions inside the automation's namespaces, using the person's extensions and no server tools. Its approvals belong to the person, so they show inGET /api/v1/approvals, and carryorigin: {automation, run, node}.Prompts: params marked
"format": "prompt"are rendered withactions.render_prompt. Before the model sees them, it marks two things as data (untrusted.wrap): each activity'slens.untrustedfields, and everything earlier steps passed on.ask_agentpasses the activity the same way. Model calls run in the run's ledger scope and stop once a budget they count for is used up (budgets.used_up).Motivation and Context
Workflow studio, module M7 (plan:
/mnt/project-files/workflow-studio/plan.md§5 M7), PR 2 of 5. #433 addednotify; web, Lens work and asset actions follow.Choices taken (reversible):
ai_tools.approvecarries out approvedwrite_note/update_noteas the approving person.accountandorigin.useris the automation identity (theby), andaccountis the person. Approvals, extensions, the timeline view and timeline marks useaccount. Chat behaviour is unchanged (accountdefaults touser["id"]).budgets.used_up(db, refs)checks the run's scope, its namespaces andautomation:<id>. The automation ref counts once M6 adds it tobudgets.REF.format: prompt,render_prompt) was sent to the M6 thread for the engine to call.Types of changes
!in the title)Checklist:
tests/api/test_actions_ai.pycovers:ask_model: text, JSON, dry run, no model, budget refusalcall_tool: read tools, approvals as the person with origin, notes approved and written, the person's permissions, namespacesask_agent: saved chat, approvals, limited tools, max steps, dry run, a model without toolsrender_promptmarking outside textdocs/accordingly (docs/automations.mdActions rows and "The model and the agent",docs/assistant.mdApprovals).Done questions (AGENTS.md)
actions.catalog()(M6 serves it to the API, MCP and the assistant).about= the event,max_steps6, the person's usual tools).originfield; no change to stored data.docs/automations.md:🤖 Generated with Claude Code
https://claude.ai/code/session_01CyjR2zEfmTXBewKAx9Taw5
Generated by Claude Code