Pipeline block ⑥ (Call as a function: invoke a compiled workflow). Part of the compile-to-weights epic. This is the "use a compiled workflow via a stargraph call/function" piece.
Context. A graph can be driven via CLI (cli/run.py), the Python API (Graph.start() → GraphRun), and REST (serve/api.py POST /v1/runs:684). But there is no "graph as a callable function/tool" wrapper, and no turnkey "invoke the compiled version of workflow X by registry alias."
Proposal. Two thin surfaces:
- graph-as-tool: new
src/stargraph/tools/graph_invoke.py (model on tools/decorator.py) — a tool that takes graph_id + optional initial_state patch, runs Graph.start() → GraphRun, returns final_state. Lets one graph call a compiled workflow as a tool.
- invoke-by-alias: a thin path over the existing
POST /v1/runs (serve/api.py:684, Scheduler.enqueue) + Python API that resolves the compiled-model production/staging alias (block ④ registry) for the graph, so callers invoke "the current compiled workflow" by name and the alias-flip swaps the served checkpoint underneath.
Acceptance criteria.
Depends on block ⑤ (CompiledWorkflowNode) and block ④ (registry runtime).
Source: arXiv:2605.22502v1 — "Compiling Agentic Workflows into LLM Weights" (subterranean agents). Part of the end-to-end compile-to-weights pipeline epic; file refs verified against current main. Determinism: per-graph knob (fully-compiled | hybrid | rules-only) defaults to honor #117 (no learned core router).
Pipeline block ⑥ (Call as a function: invoke a compiled workflow). Part of the compile-to-weights epic. This is the "use a compiled workflow via a stargraph call/function" piece.
Context. A graph can be driven via CLI (
cli/run.py), the Python API (Graph.start()→GraphRun), and REST (serve/api.py POST /v1/runs:684). But there is no "graph as a callable function/tool" wrapper, and no turnkey "invoke the compiled version of workflow X by registry alias."Proposal. Two thin surfaces:
src/stargraph/tools/graph_invoke.py(model ontools/decorator.py) — a tool that takesgraph_id+ optionalinitial_statepatch, runsGraph.start()→GraphRun, returnsfinal_state. Lets one graph call a compiled workflow as a tool.POST /v1/runs(serve/api.py:684,Scheduler.enqueue) + Python API that resolves the compiled-modelproduction/stagingalias (block ④ registry) for the graph, so callers invoke "the current compiled workflow" by name and the alias-flip swaps the served checkpoint underneath.Acceptance criteria.
graph_invoketool runs a named graph and returns its final state as tool output.Depends on block ⑤ (CompiledWorkflowNode) and block ④ (registry runtime).
Source: arXiv:2605.22502v1 — "Compiling Agentic Workflows into LLM Weights" (subterranean agents). Part of the end-to-end compile-to-weights pipeline epic; file refs verified against current
main. Determinism: per-graph knob (fully-compiled | hybrid | rules-only) defaults to honor #117 (no learned core router).