Index
instruments
¶
Instrument execution backends for Marianne.
This package contains config-driven backends that execute prompts through CLI instruments defined by InstrumentProfile YAML files.
The PluginCliBackend is the generic execution engine — it reads a CliProfile and builds commands, parses output, and classifies errors for any CLI tool without requiring instrument-specific Python code.
Classes¶
PluginCliBackend
¶
Bases: Backend
Generic CLI backend driven by an InstrumentProfile.
Builds CLI commands, runs them via asyncio subprocess, and parses output according to the profile's output and error configuration.
This is the core of the instrument plugin system — any CLI tool with a YAML profile can be used as a mzt instrument.
Initialize from an InstrumentProfile.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
profile
|
InstrumentProfile
|
The instrument profile describing how to invoke and parse this CLI tool. |
required |
working_directory
|
Path | None
|
Optional working directory for subprocess. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If the profile is not a CLI instrument. |
Source code in src/marianne/execution/instruments/cli_backend.py
Attributes¶
Functions¶
apply_overrides
¶
Apply per-sheet parameter overrides for the next execution.
Supports:
- model: Override the default_model from the instrument profile.
Must be paired with clear_overrides() after execution. Callers MUST hold override_lock for the entire apply → execute → clear window when parallel execution is possible.
Source code in src/marianne/execution/instruments/cli_backend.py
clear_overrides
¶
Restore original backend parameters after per-sheet execution.
Source code in src/marianne/execution/instruments/cli_backend.py
set_preamble
¶
set_prompt_extensions
¶
set_output_log_path
¶
execute
async
¶
Execute a prompt through the CLI instrument.
Builds the command from profile config, runs it as a subprocess, and parses the output according to the profile's output config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompt
|
str
|
The prompt to execute. |
required |
timeout_seconds
|
float | None
|
Per-execution timeout override. |
None
|
Returns:
| Type | Description |
|---|---|
ExecutionResult
|
ExecutionResult with parsed output and metadata. |
Source code in src/marianne/execution/instruments/cli_backend.py
582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 | |
health_check
async
¶
Check if the CLI instrument is available.
Verifies the executable exists on PATH. Does not run a test prompt — that would consume API quota.
Returns:
| Type | Description |
|---|---|
bool
|
True if the executable is found on PATH. |