Repository navigation
feat(automations): save automations for their maker, with checks and an API - #451
Merged
Merged
Conversation
…an API An automation is saved with its triggers, join, If, a Then (a graph saved as a workflow of scope event, or a saved one), namespaces its person can edit, limits and a policy. It is switched on and off (enabled_at records when), deleted with restore as the undo, and only the person in a signed-in session lets a node run on its own. Schedules, webhooks and joins other than any are refused as coming soon until their modules land, and are armed through them once they are there. GET /automations/actions lists the action catalog. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VCAZ9NEmBJNovqdzxvK3qi
…-sxrerj # Conflicts: # docs/automations.md
…-sxrerj # Conflicts: # docs/automations.md # fastapi_backend/tests/domain/test_automation_nodes.py # nextjs-frontend/app/openapi-client/index.ts # nextjs-frontend/app/openapi-client/sdk.gen.ts
…-sxrerj # Conflicts: # docs/automations.md
…-sxrerj # Conflicts: # docs/automations.md
…-sxrerj # Conflicts: # docs/automations.md
…-sxrerj # Conflicts: # docs/automations.md # fastapi_backend/app/api/v1/router.py # nextjs-frontend/app/openapi-client/index.ts # nextjs-frontend/app/openapi-client/sdk.gen.ts # nextjs-frontend/app/openapi-client/types.gen.ts # nextjs-frontend/openapi.json
…-sxrerj # Conflicts: # docs/automations.md # nextjs-frontend/app/openapi-client/sdk.gen.ts # nextjs-frontend/app/openapi-client/types.gen.ts # nextjs-frontend/openapi.json
…-sxrerj # Conflicts: # docs/automations.md
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: an automation's shapes (triggers, joins, an If, a policy) could be checked, and its Then drawn as an event workflow, but nothing kept an automation.
After:
POST /api/v1/automationssaves one for the person who makes it (run_as), working in namespaces they can edit (by default each one they edit; an admin's works everywhere). Its Then is a graph, saved as a workflow of scopeevent, or a saved event workflow.GET,PATCH,DELETE(with/restoreto undo),/enableand/policymanage it, andGET /automations/actionslists the actions an action node can take. Running automations is the next PR.How:
app/domain/automations.pychecks every save (triggers, join, If, graph, namespaces, limits, policy) and keeps an existingautopick only where it already was. Only the person, signed in to the web app, lets a node run on its own (POST /automations/{id}/policy); API keys, apps and agents get a 403. Webhook triggers get their address when saved (automation_hooks.token_for, from #442): the answer'shooksgives each new one's URL and signing secret once, saving again keeps it, and a webhook trigger that is dropped has its hook revoked at once. Saving sets the timers of itsscheduleandattriggers throughtimers.schedule_automation(#450), and switching it off or deleting it calls them off; they start runs once running automations lands (next PR). Joins other thananyare refused as coming soon until joins land. Credentials in anhttp_requestnode's headers are sealed when the graph is saved (actions_web.seal_headers, from #439), with the key of the automation's first namespace and bound to the automation and the node's address; a{{ }}value stays as written, and a credential needs a written-out url. Switching on recordsenabled_at, so turning one on never replays the past. Admins see every automation; anyone else sees only those working entirely in namespaces they edit, and others answer 404.Motivation and Context
Workflow studio, module M6 (automation engine), part 2 of 5: storage and checks. Next come running them (dispatcher, runs, limits, budgets), agent tools, and drafting from a sentence.
Types of changes
!in the title)Checklist:
make hookschecks it on commit).docs/accordingly.## UnreleasedinCHANGELOG.md. (n/a: the changelog line comes with running them, the next PR)Done questions (AGENTS.md)
autoonly from a signed-in session; web-call credentials sealed with the namespace key on save. Threat model entries come with running them.auto; nothing runs yet; no defaults change.automationtable (DEFINE TABLE, idempotent); no existing data changes.tests/api/test_automations.py;tests.helpers.withouthides studio modules not merged yet, so the "coming soon" checks here and from feat(workflows): an event scope for automations, with action and decide nodes #436 hold as M4 and M5 land), docs (docs/automations.md,docs/api.md) and the generated client (make openapi) updated.docs/automations.md.Checked locally: full backend suite (1262 passed, with a test that a schedule sets its timer and switching off or deleting calls it off), ruff, mypy, the threat model check and
mkdocs build --strict.🤖 Generated with Claude Code
https://claude.ai/code/session_01VCAZ9NEmBJNovqdzxvK3qi