Commit c5e09a6
authored
Add callable and conditional parallel branches (0075) (#175)
* Add callable and conditional parallel branches (0075)
A BranchSpec's work may now be given as `call` (an inline async function
over the parent state returning a parent-shaped partial) instead of a
compiled `subgraph`, and any branch may carry a `when` predicate that
skips it at dispatch. `subgraph` becomes optional; exactly one of
subgraph/call per branch and no inputs/outputs on a callable branch,
else the new compile-time ParallelBranchesInvalidBranchSpec. A node may
mix both forms. All-branches-skipped is a valid no-op.
A callable branch is the unit of work: it emits one started/completed
observer pair keyed by branch_name at the parallel-branches node's own
namespace, which both bundled observers render as a single per-branch
dispatch span (OTel) / observation (Langfuse) with no inner-node span; a
when-skipped branch emits nothing. The NODE event's branch_count is the
number of branches that dispatch (when-skipped excluded), while
branch_names stays the full declared set.
Also fix a pre-existing duplicate Langfuse observation for
parallel-branches and fan-out nodes: those emit their own NODE
observation, so synthesizing a subgraph-wrapper observation at the same
namespace duplicated it. Mirror the OTel observer's existing guard so
inner work parents under the single NODE observation.
* Pin spec to v0.66.1 and wire 0075 conformance
Advance the spec submodule, __spec_version__, pyproject spec_version,
and conformance.toml spec_pin to v0.66.1. This absorbs 0075 (v0.66.0)
and the v0.66.1 patch (a call-level-retry Langfuse-mapping clarification
the observer already satisfies, no code change). Mark proposal 0075
implemented and regenerate the bundled AGENTS.md.
Wire conformance fixtures 073-075: the adapter parses the `call` and
`when` branch directives, the fixture schema makes `subgraph` optional,
and the pipeline-utilities driver registers the three fixtures.
Document callable branches and conditional `when` in the parallel-
branches concept page, and extend the example with a pure inline
reading-time callable branch and a `when`-gated translation branch so it
covers both branch forms.
* Carry node attempt index on callable-branch events
The callable-branch started/completed pair hard-coded attempt_index=0.
Under node-level retry that mis-reports the graph-engine §6 keying tuple
and the Langfuse observation's metadata.attempt_index on the second and
later attempts. Read current_attempt_index() once at dispatch entry,
before the branch chain (which may run its own retries) so the pair
shares one value, and thread it through all three dispatches.1 parent d803356 commit c5e09a6
23 files changed
Lines changed: 1258 additions & 163 deletions
File tree
- docs
- concepts
- examples
- examples/parallel-branches
- src/openarmature
- graph
- observability
- langfuse
- otel
- tests
- conformance
- harness
- unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
19 | | - | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
79 | 134 | | |
80 | 135 | | |
81 | 136 | | |
| |||
113 | 168 | | |
114 | 169 | | |
115 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
116 | 209 | | |
117 | 210 | | |
118 | 211 | | |
| |||
144 | 237 | | |
145 | 238 | | |
146 | 239 | | |
147 | | - | |
148 | | - | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
149 | 244 | | |
150 | 245 | | |
151 | 246 | | |
0 commit comments