reach.run¶
Orchestration engine for conducting evaluation runs, assembling catalogs, and executing probe loops.
Orchestrate evaluation runs, catalog composition, probe execution, and persistence.
Composition ¶
Bases: BaseModel
Hold validated components including config, query set, catalog, and corpus.
Source code in src/reach/run.py
provenance
property
¶
provenance: Provenance
Derive Provenance metadata from configuration, corpus, and query set.
Plan ¶
Bases: BaseModel
Summarize execution parameters, target sizes, and workloads.
Source code in src/reach/run.py
per_query_resolution
property
¶
Calculate detectable effect size threshold for individual queries.
ProbeHarness ¶
Coordinate concurrent probe attempts, retries, and result streaming.
Source code in src/reach/run.py
549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 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 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | |
__init__ ¶
__init__(
runtime: AgentRuntime,
*,
workers: int = 1,
retries: int = 2,
backoff_s: float = 5.0,
pause_s: float = 0.0,
sleep: Callable[[float], None] = sleep,
cache_outcomes: bool = True,
outcome_cache: dict[ProbeOutcomeCacheKey, ProbeResult]
| None = None,
) -> None
Initialize probe harness with runtime driver and execution options.
Source code in src/reach/run.py
probe ¶
probe(
query: Query,
catalog: Catalog,
workdir: Path,
*,
attempt: int = 1,
provenance: Provenance | None = None,
fit: CatalogFit | None = None,
) -> ProbeResult
Execute a single query probe attempt with catalog residency validation.
Source code in src/reach/run.py
run ¶
run(
composition: Composition,
*,
out_path: Path | None = None,
resume: bool = True,
append_across_arms: bool = False,
allow_truncation: bool = False,
progress: Callable[[int, int, ProbeResult], None]
| None = None,
) -> RunOutcome
Execute an evaluation run end-to-end and persist results and sidecar configuration.
Source code in src/reach/run.py
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 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 | |
run_probes ¶
run_probes(
queries: Sequence[Query],
catalog: Catalog,
workdir: Path,
*,
attempts: int = DEFAULT_ATTEMPTS,
out_path: Path | None = None,
skip: set[tuple[str, int]] | None = None,
provenance: Provenance | None = None,
fit: CatalogFit | None = None,
) -> Iterator[ProbeResult]
Execute probe batches across queries with thread pooling, retries, and persistence.
Source code in src/reach/run.py
ProbeOutcomeCacheKey ¶
Bases: BaseModel
Identify a content-addressed probe outcome by resident skills and query.
Source code in src/reach/run.py
RunOutcome ¶
Bases: BaseModel
Hold results, artifact, and full context models from a completed evaluation run.
Source code in src/reach/run.py
composition
property
¶
composition: Composition
Construct the Composition corresponding to this run outcome.
artifact ¶
artifact(
*,
roots: Sequence[Path] | None = None,
contested: Sequence[ContestedSkill] = (),
sample_queries: int = DEFAULT_SAMPLE_QUERIES,
) -> Artifact
Construct the canonical Artifact document for this evaluation outcome.
Source code in src/reach/run.py
compose ¶
compose(
config: RunConfig, skills: Sequence[Skill] | None = None
) -> Composition
Resolve and validate the target catalog and query set for an evaluation run.
Source code in src/reach/run.py
conduct ¶
conduct(
config: RunConfig,
runtime: AgentRuntime | None = None,
*,
progress: Callable[[int, int, ProbeResult], None]
| None = None,
resume: bool = True,
append_across_arms: bool = False,
allow_truncation: bool = False,
composed: Composition | None = None,
workers: int | None = None,
outcome_cache: dict[ProbeOutcomeCacheKey, ProbeResult]
| None = None,
) -> RunOutcome
Execute an evaluation run end-to-end and return the full RunOutcome.
Source code in src/reach/run.py
evaluate ¶
evaluate(
config: RunConfig,
runtime: AgentRuntime | None = None,
*,
skills: Sequence[Skill] | None = None,
auto_draft: bool = False,
progress: Callable[[int, int, ProbeResult], None]
| None = None,
resume: bool = True,
append_across_arms: bool = False,
allow_truncation: bool = False,
composed: Composition | None = None,
workers: int | None = None,
) -> RunOutcome
Execute an evaluation run, resolving or drafting queries, and probing skills.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
RunConfig
|
Run configuration specifying study parameters and options. |
required |
runtime
|
AgentRuntime | None
|
Optional AgentRuntime instance to use; if None, built from config. |
None
|
skills
|
Sequence[Skill] | None
|
Optional sequence of pre-loaded Skill instances; if None, loaded from corpus. |
None
|
auto_draft
|
bool
|
Whether to automatically draft queries if not already present on disk. |
False
|
progress
|
Callable[[int, int, ProbeResult], None] | None
|
Optional callback invoked as each probe completes. |
None
|
resume
|
bool
|
Whether to resume from existing results on disk. |
True
|
append_across_arms
|
bool
|
Whether to append results across different study arms. |
False
|
allow_truncation
|
bool
|
Whether to proceed if the catalog exceeds runtime prompt limits. |
False
|
composed
|
Composition | None
|
Optional pre-constructed Composition instance. |
None
|
workers
|
int | None
|
Number of concurrent workers executing probes. |
None
|
Returns:
| Type | Description |
|---|---|
RunOutcome
|
A RunOutcome instance containing results, catalog, query set, and artifact. |
Source code in src/reach/run.py
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 | |
load_corpus ¶
Load skill corpus from configured path.
Source code in src/reach/run.py
load_results ¶
load_results(path: Path | str) -> list[ProbeResult]
Load previously recorded ProbeResult records from a JSONL file.
Source code in src/reach/run.py
plan_only ¶
write_results ¶
write_results(
path: Path | str, results: Iterable[ProbeResult]
) -> Path
Persist a collection of ProbeResult models as JSON lines to the target file.