Docs homeCore ConceptsBranches

Branches

Branches are execution pipelines that chain Buds together into a governed workflow. They define inputs, outputs, sequencing, and execution constraints.

A Branch is a directed execution pipeline. It defines a sequence of Bud calls, the data flow between them, the expected inputs it accepts, the output it produces, and the execution constraints that govern it. Branches are the unit of composition in Stackmint — they are what gets installed into Workspaces as Capabilities.

Branch structure

A Branch is defined by:

  • expected_inputs — The inputs the Branch accepts, with types and required/optional designation. These are what users provide when triggering the Branch.
  • expected_outputs — The shape of the Branch's final output.
  • prompt — A template string that can reference both expected inputs and context Variables using {{ variable_name }} syntax.
  • Bud sequence — The ordered list of Buds to execute, with input/output wiring between them.
  • timeout_seconds — Maximum execution duration. Default is 300 seconds.
  • max_retries — Number of times a failing Bud will be retried before the execution is marked failed.
  • max_budget_credits — Maximum credits this Branch can consume in a single execution.

Branch status

Branches exist in one of two states:

  • Draft — Under development. Can be tested in the Branch Editor but not installed into production Workspaces.
  • Published — Available for installation. Published Branches are versioned and immutable — any change creates a new version.

Execution model

When a Branch is triggered, the execution engine:

  1. Validates the provided inputs against expected_inputs
  2. Loads Workspace context Variables and resolves {{ variable_name }} placeholders in the prompt
  3. Checks the Workspace model allow list and budget ceiling
  4. Executes each Bud in sequence, passing outputs to the next Bud's inputs
  5. At HITL checkpoints, suspends execution and notifies approvers
  6. Validates the final output against expected_outputs
  7. Seals and writes the execution trace to the audit log

Templating

Branch prompts and Bud input templates use the {{ variable_name }} syntax. Variables are resolved from two sources in order of priority:

  1. Execution inputs — the values provided by the user or calling system when triggering the Branch
  2. Workspace context Variables — the key/value pairs configured in Workspace settings

If a required Variable cannot be resolved at execution time, the execution fails with a descriptive error.

Sub-Branch invocation

A Branch can trigger other Branches as sub-executions via the Dendrite engine or via explicit InvokeBranchBud calls. Sub-Branches share the parent's budget ceiling and inherit the parent's governance policies. The platform enforces a maximum recursion depth of 8 levels.

Versioning and marketplace

Published Branches are versioned. Workspaces pin to a specific version when they install a Capability. Patch updates (non-breaking) can be applied automatically; major version changes require explicit Workspace migration. Partners can publish Branches to the Stackmint marketplace, making them available to all client Workspaces. See Publish to Marketplace.