reach.runtime¶
Agent execution runtime interfaces, CLI subprocess template drivers, Antigravity domain bridges, and trajectory telemetry.
Define the core AgentRuntime interface and shared runtime agent helpers.
AgentOptions ¶
Bases: BaseModel
Base configuration common to all agent drivers.
Source code in src/reach/runtime/__init__.py
custom_isolation_dir
property
¶
Return custom isolation directory path configured on this options instance, if any.
AgentRuntime ¶
Bases: ABC
Define standard abstract base class for agent runtime implementations.
Source code in src/reach/runtime/__init__.py
548 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 792 793 794 795 796 | |
allowed_tools
property
¶
Return explicit allowed tools override from options or settings.
auto_clean
property
¶
Return whether automatic post-probe cleanup is enabled on the runtime options.
blocked_env_vars
property
¶
Return explicit blocked environment variables override from options or settings.
custom_isolation_dir
property
¶
Return the configured custom isolation directory path, or None.
effective_effort
property
¶
Return configured reasoning effort or default from model profile.
isolate_config_dir
property
¶
Return whether isolated runtime config is enabled on the runtime options.
isolation_dir_field
property
¶
Return the options field name used for custom directory isolation, if supported.
rations_catalog
property
¶
Return True if this runtime actively rations skill listing budgets.
skills_subpath
property
¶
Return relative skill directory subpath from profile or runtime default.
timeout_s
property
¶
Return per-probe execution timeout in seconds from settings.
use_symlinks
property
¶
Return whether symlink installation is enabled on the runtime options.
__init__ ¶
__init__(
settings: RuntimeSettings | None = None,
options: OptionsT | None = None,
) -> None
Initialize agent runtime settings and options.
Source code in src/reach/runtime/__init__.py
build_env ¶
Assemble process environment for agent execution.
cleanup ¶
clone_isolated ¶
fit ¶
fit(
catalog: Catalog, skills: Iterable[Skill]
) -> CatalogFit
Evaluate whether a catalog fits listing budgets without materializing.
install ¶
Materialize resident skills in workspace and return workspace path.
Source code in src/reach/runtime/__init__.py
make_tracker ¶
make_tracker(
target_skill: str | None = None,
) -> TrajectoryTracker
Create a TrajectoryTracker configured with this runtime's turn and early-exit options.
Source code in src/reach/runtime/__init__.py
parse_stream ¶
parse_stream(
lines: Iterable[str],
resident: Sequence[str] = (),
early_exit: bool = False,
) -> SessionSummary
Parse transcript or log lines into a standardized SessionSummary.
Default implementation records early_exit and assigns SUCCESS status if lines were produced. Subclasses override this to extract tool invocations, reasoning, and telemetry.
Source code in src/reach/runtime/__init__.py
post_probe ¶
resident_skill_paths ¶
Return set of valid filesystem directory paths for resident skills.
Source code in src/reach/runtime/__init__.py
select
abstractmethod
¶
select(
query_text: str,
workdir: Path,
target_skill: str | None = None,
) -> SelectionOutcome
Execute a single query probe and return the observed skill selection.
skill_roots ¶
skill_roots(workdir: Path) -> tuple[SkillRoot, ...]
Return discovery directories where runtime searches for skills.
Source code in src/reach/runtime/__init__.py
skills_dir ¶
AntigravityRuntime ¶
Bases: AgentRuntime
Shared base runtime for Antigravity-ecosystem drivers (CLI and SDK).
Source code in src/reach/runtime/__init__.py
973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 | |
effective_api_key
property
¶
Return configured API key or fallback to environment variables.
effective_model_provider
property
¶
Return configured model_provider or auto-detect 'gemini' when API keys are present.
selection_tools
property
¶
Return standard inspection tool identifiers permitted during skill selection.
selection_json_schema
classmethod
¶
Derive JSON Schema string directly from the canonical Pydantic model.
Source code in src/reach/runtime/__init__.py
selection_schema
classmethod
¶
selection_schema(
resident: Sequence[str],
) -> type[SkillSelectionBase]
Generate dynamic Pydantic model constraining selection to resident skills.
Source code in src/reach/runtime/__init__.py
CatalogFit ¶
Bases: BaseModel
Report catalog residency limits and potential description truncation metrics.
Source code in src/reach/runtime/__init__.py
CliAgentRuntime ¶
Bases: AgentRuntime[CliOptionsT], ABC
Abstract base runtime for command-line interface agent drivers.
Source code in src/reach/runtime/__init__.py
799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 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 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 | |
__init__ ¶
__init__(
settings: RuntimeSettings | None = None,
options: CliOptionsT | None = None,
) -> None
Initialize CLI agent runtime settings and options.
Source code in src/reach/runtime/__init__.py
build_command
abstractmethod
¶
build_env ¶
Assemble process environment with API keys and workspace overrides.
Source code in src/reach/runtime/__init__.py
effective_isolation_dir ¶
Return the effective isolated configuration directory for the given workspace.
Source code in src/reach/runtime/__init__.py
extract_skill_from_line ¶
extract_skills_from_line ¶
Extract invoked skill names from an event line for early-exit detection.
parse_stream
abstractmethod
¶
parse_stream(
lines: Iterable[str],
resident: Sequence[str] = (),
early_exit: bool = False,
) -> SessionSummary
Parse CLI stdout lines into a standardized session summary.
Source code in src/reach/runtime/__init__.py
post_probe ¶
Clean isolated configuration directory after probe if auto_clean is enabled.
Source code in src/reach/runtime/__init__.py
select ¶
select(
query_text: str,
workdir: Path,
target_skill: str | None = None,
) -> SelectionOutcome
Execute a query probe via the unified CLI subprocess template pipeline.
Source code in src/reach/runtime/__init__.py
validate_outcome ¶
validate_outcome(
summary: SessionSummary, workdir: Path
) -> str | None
Validate status and security isolation boundaries for a parsed session.
Source code in src/reach/runtime/__init__.py
CliOptions ¶
Bases: AgentOptions
Hold common configuration options for CLI subprocess-driven agent runtimes.
Source code in src/reach/runtime/__init__.py
SelectionOutcome ¶
Bases: SessionSummary
Represent the observable result of probing an agent runtime with a query.
Source code in src/reach/runtime/__init__.py
SessionStatus ¶
Bases: StrEnum
Enumerate canonical terminal execution statuses of an agent session.
Source code in src/reach/runtime/__init__.py
SessionSummary ¶
Bases: BaseModel
Hold parsed session outcomes and telemetry across CLI runtime logs.
Source code in src/reach/runtime/__init__.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | |
invoked_skill
property
¶
Return the first invoked skill name, or None if none was invoked.
saw_result
property
¶
Return True if stream contained a terminal result event or early exit.
to_outcome ¶
to_outcome(
observed_catalog: tuple[str, ...] | list[str] = (),
fallback_model: str = "",
early_exit: bool = False,
turns_taken: int | None = None,
) -> SelectionOutcome
Convert parsed session summary into a canonical SelectionOutcome.
Source code in src/reach/runtime/__init__.py
SkillRoot ¶
Bases: BaseModel
Represent a skill discovery directory location and its resolution precedence.
Source code in src/reach/runtime/__init__.py
SkillSelectionBase ¶
Bases: BaseModel
Base model declaring structured skill selection response interface.
Source code in src/reach/runtime/__init__.py
TextGenerator ¶
Bases: Protocol
Protocol for models or drivers capable of generating raw text completions.
Source code in src/reach/runtime/generator.py
ToolCallInfo ¶
Bases: BaseModel
Represent an observed tool invocation and its parameters.
Source code in src/reach/runtime/__init__.py
target_path
property
¶
Extract first non-empty filesystem path from recognized tool parameters.
__init__ ¶
__init__(
name: str = "",
parameters: dict[str, Any] | None = None,
path: str | None = None,
**data: Any,
) -> None
Initialize tool invocation with optional direct path argument.
Source code in src/reach/runtime/__init__.py
TrajectoryTracker ¶
Track multi-turn skill invocations and evaluate early exit conditions.
Source code in src/reach/runtime/__init__.py
turns_taken
property
¶
Return count of turns taken based on distinct recorded invocations.
__init__ ¶
Initialize tracker with optional target skill and turn boundaries.
Source code in src/reach/runtime/__init__.py
apply_to_outcome ¶
apply_to_outcome(
outcome: SelectionOutcome,
) -> SelectionOutcome
Normalize a SelectionOutcome through tracker early-exit and turn invariants.
Source code in src/reach/runtime/__init__.py
observe ¶
Record skill invocation(s) and return True if early-exit stop condition is met.
Source code in src/reach/runtime/__init__.py
TwoStageRetrieverRuntime ¶
Bases: AgentRuntime
Wrap an AgentRuntime with a Stage-1 lexical pre-filter to top-k candidate skills.
Source code in src/reach/runtime/retriever.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
skills_subpath
property
¶
Return relative skill directory subpath from the underlying runtime.
__init__ ¶
__init__(
inner: AgentRuntime,
top_k: int = 8,
scorer: TextScorer | None = None,
*,
cache_outcomes: bool = True,
) -> None
Initialize the retriever runtime wrapping an underlying agent runtime.
Source code in src/reach/runtime/retriever.py
cleanup ¶
Clean up inner runtime and all thread-local worker clones.
Source code in src/reach/runtime/retriever.py
fit ¶
fit(
catalog: Catalog, skills: Iterable[Skill]
) -> CatalogFit
Forward catalog fit evaluation to the underlying runtime.
install ¶
Index skills for pre-filtering, record residency, and reset per-scale call counts.
Source code in src/reach/runtime/retriever.py
select ¶
select(
query_text: str,
workdir: Path,
target_skill: str | None = None,
) -> SelectionOutcome
Pre-filter catalog to top-k skills and execute probe in an isolated slot.
Source code in src/reach/runtime/retriever.py
agent_default_model ¶
Return default model identifier for the specified agent runtime.
Source code in src/reach/config.py
antigravity_agents ¶
Return tuple of supported agent runtime names that inherit from AntigravityRuntime.
Source code in src/reach/runtime/__init__.py
build_runtime ¶
build_runtime(settings: RuntimeSettings) -> AgentRuntime
Instantiate and configure an AgentRuntime from settings.
Source code in src/reach/runtime/__init__.py
build_text_generator ¶
build_text_generator(
model: str | None = None,
agent: str | None = None,
timeout_s: float | None = None,
options: Mapping[str, Any] | None = None,
) -> BaseTextGenerator[Any]
Construct a TextGenerator instance configured for query drafting or optimization.
Source code in src/reach/runtime/generator.py
builtin_tool_names ¶
Return canonical built-in tool primitives across all supported agent harnesses.
Source code in src/reach/runtime/__init__.py
cli_agents ¶
Return tuple of supported agent runtime names that execute via CLI subprocesses.
Source code in src/reach/runtime/__init__.py
find_agent_for_model ¶
Dynamically determine which agent runtime supports the given model.
Source code in src/reach/runtime/__init__.py
known_agents ¶
Return tuple of supported agent runtime names from configuration.
Source code in src/reach/runtime/__init__.py
options_model ¶
Return the options schema class corresponding to the named agent.
Source code in src/reach/runtime/__init__.py
register_agent ¶
register_agent(
name: str,
factory: Callable[[RuntimeSettings], AgentRuntime],
options: type[BaseModel] | None = None,
) -> None
Register a runtime factory and optional options schema for an agent name.
Source code in src/reach/runtime/__init__.py
resolve_options ¶
resolve_options(
settings: RuntimeSettings,
) -> BaseModel | None
Parse and validate agent-specific options dictionary against its schema.
Source code in src/reach/runtime/__init__.py
runtime_class ¶
runtime_class(agent: str) -> type[AgentRuntime] | None
Return the runtime implementation class corresponding to the named agent.