Overview
Programmatic BlueprintRun lets an external application start and supervise a Genesis blueprint mission by HTTP API. The external app can keep its own user experience while Genesis handles the mission thread, phase execution, work log, repository artifacts, and event stream. This is useful when a partner or host application wants to:- launch a Genesis workflow from its own UI
- provide a catalog, dataset, or case file as input
- pause Genesis at structured gates for host-side choices
- receive progress and completion events
- read final mission artifacts from the Genesis project repository
Reference example
A complete local example is included in the Genesis repo:
The example demonstrates the main production pattern: the browser talks only to
the BFF, and the BFF calls Genesis with
Authorization: Bearer ....
The reference blueprint shipped in Genesis is atlas_dataroom_review_demo
(Cedar Health dataroom review). It uses string phase ids (catalog,
select_documents, …) and a manifest phase_order so the document-flow graph,
default next-phase hints, and BlueprintRun gates stay aligned.
REST endpoints
All routes are under/api and require Authorization: Bearer <PAT or JWT> with
access to the run’s agent. Commit-style routes accept an optional
Idempotency-Key header (max 120 characters); replays with the same body return
204, mismatched bodies return 409.
Mission detail responses also expose
blueprint_run_id when the mission thread
is attached to a programmatic run (GET /api/projects/{project_id}).
Core flow
- The host BFF starts a run:
- Genesis creates the mission project and thread, binds them to the run, and enters the blueprint’s requested entry phase (after high-risk tool policy preflight passes). This startup work is completed before the create response is returned.
-
Genesis schedules the kickoff agent turn and emits BlueprintRun events. The
kickoff message supplies mission context; it does not enter the same phase a
second time. For a pre-entered phase, the message also includes the
ENTER_PHASEresult: its public briefing (up to 8,000 characters) and any injected documents returned by the phase. Injected-document content is bounded to an 8,000-character serialized section; truncated content includesmetadata.file_pathandmetadata.repo_idso the agent can re-read the authoritative file from the mission repository when needed. Phase instructions appear once in this structured entry contract alongside the phase purpose and actions; kickoff notes and injected documents remain separate. The 24,000-character serialized-contract budget applies to the whole contract. If it is exceeded, Genesis omits the contract and requires the agent to read it back from the same source and version.
run_failed terminal event for the run. Poll GET /api/runs/{run_id} or the
events endpoint instead of treating a missing kickoff message as an indefinitely
pending startup.
If the blueprint requires high-risk tools that are blocked workspace-wide,
POST /api/blueprints/{blueprint_name}/runs returns HTTP 409 with
error_type policy_blocked and does not create a run. See
Blueprint mission-start tool policy preflight.
-
If the blueprint opens an external input gate, Genesis exposes that gate in
pending_inputsand shows it in the Genesis mission UI. - The host app commits or details a gate through:
- Genesis continues the mission and writes artifacts into the mission repository.
- The host app can browse or download artifacts through Genesis repo APIs, or through its own BFF proxy.
Starting a run
The request body is aBlueprintRunCreateRequest. Important fields:
Example:
kickoff_notes is the generic way to tell the running agent what the host
wants it to do. inputs is for machine-readable host state that should be
persisted on the run and echoed in events.External input gates
A blueprint can declare programmatic external gates in its manifest:input_id:
details vs commit
Some gates support a detail round:
intent: "details"sends structured information or a follow-up question without closing the gate.intent: "commit"satisfies the gate and lets Genesis continue.
details for clarification and commit for the final host decision.
Dynamic gates at runtime
Whenprogrammatic.allow_dynamic_external_inputs is true, the host can open an
additional gate after the run starts:
BlueprintRunRegisterExternalInputRequest: input_id, phase
(must equal current_phase), purpose, response_schema (or
response_schema_inline), optional details_request_schema_inline, and optional
response_policy (same shape as manifest external_inputs).
Auto-continue gates
External gates can define:default_after_remaining_seconds and the
configured total in default_after_seconds. Each pending row can also include
default_response (the payload Genesis will apply on timeout or early apply).
When the timer expires, Genesis applies that default_response, emits
input_resolved, and continues the run.
The Genesis mission UI and the external demo UI both surface this countdown so
operators know the run will not wait indefinitely. When exactly one gate is open
and a countdown is active, operators with API access can choose Apply default
& continue now in the mission UI; Genesis posts the manifest
default_response with intent: "commit" (same effect as waiting for the
timer).
Genesis mission UI
When a mission is backed by a BlueprintRun, Genesis surfaces operator context on every mission tab (not only above the work log):- External gate ribbon — shown while
GET /runs/{run_id}reports openpending_inputs(or compatpending_input). Displays phase, gate purpose, an External badge, auto-continue countdown, API details (run id, input ids, curl example forPOST /api/runs/{run_id}/input/{input_id}), and optional Apply default & continue now when a single gate hasdefault_after. - Catalog seed strip — when the host passed
catalog_repo_id(or equivalent) in runinputs, Genesis shows the wired read-only bot-git repo id so operators know which catalog the external app selected. Mission deliverables still go to the mission repository. - Mission Center status — an open external gate rolls an otherwise active mission up to Awaiting Input (mustard styling) instead of generic in-progress.
- Thread tab — while an external gate is open, chat in the mission thread does not clear the gate; operators fulfill it through the API (see the ribbon modal).
Manifest phase_order
Blueprints that use string phase ids (for example catalog, select_documents)
should declare explicit order under blueprint.phase_order:
phase_order for:
- document-flow graph layout and phase-modal “next step” defaults,
- mapping a numeric
active_blueprint_phaseindex to the canonical string id, - blueprint engine default progression when a phase has no
next_options.
phase_order still appear after the listed ids, sorted with
numeric ids first (numerically) then non-numeric ids (alphabetically).
Events and custom payloads
BlueprintRun emits lifecycle events such as:run_startedphase_enteredphase_exitedinput_requiredinput_resolvedcatalog_readyreview_summary_readyresults_readyrun_completerun_cancelledrun_failed
Mission repository artifacts
Genesis creates or resolves a mission repository for the run. The agent writes phase deliverables there, such as:- catalog snapshots
- selection notes
- processing outlines
- review summaries
- final results
Webhooks
Runs can include webhook specs:hmac_secret on run create, consumers can validate the HMAC signature on the
payload.
For local development, the example BFF can receive webhooks at:
WEBHOOK_PUBLIC_BASE in the example .env so the BFF adds the callback to
run creation.
Security model
Use a BFF for production-style integrations:- Keep Genesis PAT/JWT values server-side.
- Let the browser call only your BFF.
- Let the BFF enforce tenant/user rules before calling Genesis.
- Use stable
run_id,input_id, andactorvalues for auditability. - Use
Idempotency-Keyon commit-style actions where replay or retries are possible.
Where to start
- Read
examples/atlas-blueprintrun-external/README.md. - Start a local Genesis env.
- Configure the example BFF
.env. - Run
npm run dev:fullin the example folder. - Start the Cedar Health review and watch the same run in Genesis Missions.

