MAESTRO Integration
MAESTRO uses CARL as its chain execution engine. This page describes the contract between the two: what MAESTRO puts on a chain and a context, which CARL APIs it calls, and which CARL behaviour it relies on. Any other host can use the same pieces.
Which CARL MAESTRO runs
Section titled “Which CARL MAESTRO runs”The MAESTRO app does not run CARL 0.5.x yet. As of this writing it pins
mmar-carl 0.3.0+maestro.contracts.3, built from Git commit
f0afe4620d72dbf13e59b372ec3e550195a19d61 of the Glazkoff/carl development
fork, dated 2026-10-05, about a month before the 0.5.0 release on 2026-11-09. That build is CARL 0.3.0 plus a backport of the host contracts
MAESTRO needs: fail_fast, acknowledged pause and resume, runtime_input,
scoped structured-output and human-input inputs, and the
CARL_TOOL_INPUT_UNRESOLVED check. Its FORMAT_VERSION is 1 and it knows 16
step types.
So MAESTRO does not use these parts of CARL yet:
- the step types added in 0.4.0 and later:
agent,code,wait,map,command_plan,command,shell_session,claude_code,codex,selection,planner,decision,terminate; - embedded chain tools, Git tool sources, enforced skill pinning, eager tool scheduling, and the EvoC primitives;
- the 0.5.0 behaviour changes: tool failures that fail the step, decoded JSON
tool results,
allow_local_agent_execution, the shared chain deadline; - chain formats above 1. MAESTRO’s build rejects any chain saved by 0.5.x
(format 13–15) with
ChainFormatNewerError. The other direction works: 0.5.2 migrates MAESTRO’s format-1 chains and keeps theirfail_fast.
Moving MAESTRO to a 0.5.x release has not happened yet. Until it does, the rest of this page describes the contract as MAESTRO uses it with its pinned build; the CARL APIs named here exist in 0.5.2 as well.
| Piece | What it’s for |
|---|---|
| Preflight | Ask what a chain needs (tools, MCP servers, skills, code profiles, external agents) and what is missing in a context. |
| RunRecord | A durable record of one execution: chain snapshot, input, result, timing. |
| Chain metadata | The metadata["care"] block on a chain: task, files, tags, and MAESTRO’s input contract. |
How MAESTRO runs a chain
Section titled “How MAESTRO runs a chain”The desktop app runs a saved chain through one execution boundary
(care/harness_execution.py in the MAESTRO repository). In order:
- Strict parse. A chain without an explicit
fail_fastand without a RE-PLAN policy getsfail_fast: truefor the run. The chain JSON is then loaded withReasoningChain.from_dict(data, use_typed_steps=True). CARL’s warnings about unresolvable$history[...]references are promoted to errors. - Input contract. The chain carries a JSON Schema in
metadata["care"]["runtime_input_schema"], bound to the chain’s content digest. MAESTRO validates the user’s input against it before any provider call. - Context. MAESTRO builds the
ReasoningContextwithruntime_input= the validated input object, andouter_context= the task text plus the same input as JSON, wrapped in an<untrusted_runtime_input>envelope with<and>escaped. LLM steps readouter_context; tool, map, structured-output and other references read$outer_context.<field>fromruntime_input.
- Preflight.
chain.preflight(context)runs against the populated context. Any missing tool, MCP server or skill refuses the run (chain_admission_failed). - Execute.
chain.execute_async(context)runs as a task that can be cancelled. The result is projected into a receipt with digests of the chain and the input and a bounded, redacted per-step preview.
# What step 3 amounts to, without MAESTRO's envelope helper:context = ReasoningContext( outer_context=task_text_with_input_envelope, runtime_input={"city": "Paris", "nights": 3}, api=client,)# step config in the chain:ToolStepConfig(tool_name="find_hotels", input_mapping={"city": "$outer_context.city"})runtime_input is copied into every per-step context, so
$outer_context.<field> resolves inside chain.execute(). A required tool
parameter that resolves to None fails the step before the tool is called
with CARL_TOOL_INPUT_UNRESOLVED. See
dynamic references.
Run controls MAESTRO uses
Section titled “Run controls MAESTRO uses”| MAESTRO action | CARL call | Notes |
|---|---|---|
| Pause | context.request_pause() | Running steps finish; no queued step starts. |
| Status “pause requested” vs “paused” | context.is_pause_requested(), context.is_paused() | MAESTRO shows “paused” only when is_paused() is True: the scheduler is waiting and no step is active. |
| Resume | context.clear_pause() | Completed steps are not run again. No new admission. |
| Stop | context.cancel() and cancelling the task | Wakes a paused run; unstarted steps are reported as skipped. |
| Fail-fast | ReasoningChain(fail_fast=True) (from chain JSON) | After the first final failure no new step starts; result.metadata["fail_fast"] describes the stop. |
The chain timeout counts active time only; idle pause time is excluded.
Pause is process-local in MAESTRO: it does not survive an app restart. Details:
run controls and, from the app side,
Runs.
Checking the installed CARL
Section titled “Checking the installed CARL”A host can detect the contracts before relying on them:
import mmar_carlassert getattr(mmar_carl, "HOST_RUNTIME_INPUT_ABI", 0) >= 1STRUCTURED_OUTPUT_SCOPED_INPUTS_ABI and HUMAN_INPUT_SCOPED_PROMPT_ABI cover
the scoped input mappings of structured-output and human-input steps.
Known limits
Section titled “Known limits”- MAESTRO’s preflight wrapper checks
missing_tools,missing_mcp_serversandmissing_skillsonly. Its pinned CARL has no code-profile, Claude Code, Codex or decision-credential lists. - In 0.5.2,
ReasoningChain.set_care_metadata(...)keeps keys it does not model, such asruntime_input_schema, but resets the modelled fields you do not pass. See chain metadata.