2.4 KiB
2.4 KiB
Workflows
Authority: docs/architecture/agent-system.md for the lifecycle,
docs/prds/event-automation.md for inputs, repository modes and profiles.
Workflow definitions are YAML stored as a control-plane resource. The State Store validates them and the agent compiles them, each against the step vocabulary it registers, so both must see the same step types.
Adding a step type
- Write the factory in
internal/domain/workflowas aStepType. It decodes and validates its settings and returns an error for anything it cannot honour. The factory runs when a definition is saved and again when it is compiled, so a bad definition is refused on save. - Register it through a provider in
internal/infrastructure/workflowsteps/workflowsteps.go. That one list is what every process registers, which is how the validating and executing sides agree. - An agent-driven step builds on
AgentStage; do not start a second path to the agent runner. - A step that needs no repository goes in
repoFreeStepTypesindefinition.go, or workflows declaringrepository: noneoroptionalcannot use it. A step that needs one may assumetc.Dirholds a worktree only when the workflow's repository isrequired. - A step that ends the workflow sets
tc.Outcome. A workflow that runs out of steps without an outcome is parked as a definition bug. - Add a parse test (settings accepted and refused) and a run test with fake
Treesand agent runner.
Changing the definition format
- The fields a caller needs without the engine (inputs, repository, profile)
live in
task.WorkflowInterface, because the dashboard process must not import the workflow engine (cmd/archie-ui/architecture_test.go). Anything a binding or the dashboard checks goes there. - The YAML decoder rejects unknown keys. Existing stored definitions must keep parsing, so a new key is optional with a default that preserves today's behaviour.
- Examples in
examples/workflows/are parsed against the registered vocabulary byTestExampleWorkflowsParse. Add one for a new capability.
Starting a workflow from chat
task_spawn accepts workflow and an inputs object. The gateway forwards
inputs through the task creation contract; it does not interpret individual
workflows. The daemon checks inputs against the pinned WorkflowInterface
before acquiring a container and parks invalid requests with the reason.