Repository navigation
feat(automations): the variable picker's catalog and a template's preview for a draft automation - #461
Merged
Conversation
…view for a draft automation variables.catalog lists what a draft's templates can read (the run context, each trigger's activity fields from its kind's schema, the saved variables, and the outputs of the nodes before a node), with types, labels, examples and which are outside text. variables.preview renders a template against a real activity or the trigger kind's sample, prompts shown marked as the model sees them, errors with the nearest name and line. POST /api/v1/automations/variables and /preview, and the automation_variables and preview_template MCP tools. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JZDyxMfCBYNRw12CHqE9ss
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
Workflow studio M9, part 3 of 3 (variables and templates). Parts 1 (#454, templates) and 2 (#460, saved variables) are merged.
Description
Before: to write
{{ events.mail.object.subject }}you had to know the kind's field names. The only way to see what a template gives was to save the automation and run it.After:
variables.catalog,POST /api/v1/automations/variables {draft, node?}): what a draft automation's templates can read. Each entry has{path, type, label, example, group, untrusted}.user.email,namespace.name,now...).events.<as>.<field>, from its kind's schema with the sample's values. A schedule orattrigger starts onclock.tickand a webhook onwebhook.received.event.<field>for the fields every trigger's kinds share. A batch's activities come as a list (events.mail.0...).node, what the action and decide nodes before it pass on (steps.<id>.<field>), from each action's output schema. Anask_modelwith ajson_schemagives the object that schema describes.variables.preview,POST /api/v1/automations/preview {template, draft, activity?, trigger?, node?, prompt?}): what a template gives before the automation is saved.valuekeeps its type. A prompt shows outside text marked, as the model will see it, withrules.nodeare stand-ins named by their path ([steps.ask.trip]).error(the missing variable and its nearest name) andline. A draft that doesn't check is a 400.idmust be an automation they may change, or the answer is 404.automation_variablesandpreview_template, both read-only.Motivation and Context
Workflow studio, module M9 (brief
workflow-studio/briefs/M9.md, items 6 and 7). This is what the builder's variable picker and its preview line (M11) read.Defaults taken (reversible):
event.*lists only the fields every trigger's kinds share, so a picked path works whichever trigger fired.error, so the builder can show it under the field.Types of changes
!in the title)Checklist:
make hookschecks it on commit).tests/api/test_automation_preview.py). They cover two joined kinds, an upstream action, batch and schedule triggers, a preview against the sample and against a real activity (with a 404 for one the person can't see), prompts, errors and the MCP tools.docs/accordingly:docs/automations.md(The variable picker and preview),docs/api.mdanddocs/mcp.md.## UnreleasedinCHANGELOG.md. (n/a)Done questions (AGENTS.md)
automation_variablesandpreview_templateMCP tools, as well as the REST API.make openapi.docs/automations.md: a dry-run preview of the nodes before, a saved prompt template's output schema in the picker, and matching on variables (M5). I removed the old "an action's outputs in the variable picker" bullet, which this delivers.🤖 Generated with Claude Code
https://claude.ai/code/session_01JZDyxMfCBYNRw12CHqE9ss
Generated by Claude Code