Skeleton PR: Agentic Environment for Tool Synthesis#2358
Draft
aniruddh-alt wants to merge 23 commits intomainfrom
Draft
Skeleton PR: Agentic Environment for Tool Synthesis#2358aniruddh-alt wants to merge 23 commits intomainfrom
aniruddh-alt wants to merge 23 commits intomainfrom
Conversation
Establishes the public API surface for tool-based conversation synthesis: - ToolAttribute, ToolEnvironmentAttribute config dataclasses with validation - ToolExecutor stub (parsing, execution, output formatting) - GeneratedToolEnvironment + EnvironmentRegistry stubs (stateful tools) - json_patch utility stub (RFC 6902) - MultiTurnAttribute extended with available_tools/max_tool_calls_per_turn - jsonpatch dependency added to pyproject.toml All new modules contain signatures only (raise NotImplementedError). Implementations follow in subsequent PRs.
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…-tools-01-skeleton
…archy Restructure the agentic environment skeleton to follow an environment-first ownership model: - Create `oumi/environments/` as a first-class top-level package (alongside `oumi/inference/`) for use by synthesis, evaluation, and RL - Each environment file co-locates its typed tool subclass: DeterministicEnvironment + DeterministicTool, StatefulEnvironment + StatefulTool, StatelessEnvironment + StatelessTool - Replace the monolithic ToolAttribute with BaseTool + typed subclasses that carry only fields relevant to their environment type - Remove ToolExecutor from environments (synthesis-specific concern) - Environments own tool resolution: DeterministicEnvironment.resolve(), StatelessEnvironment.resolve_cached()/cache_result() - BaseEnvironment.create() now requires 'type' explicitly (no silent default to stateful) - EnvironmentConfig.resolve_tools() raises on unknown ids instead of silently returning empty lists - Config layer no longer imports from synthesis runtime
Add type annotations to test helper functions, type-ignore comments for intentionally invalid kwargs in negative tests, and None guards for optional fields.
The test_synthesize_with_multiturn_attributes test was failing because the ConversationSynthesizer now accepts environment_config as a kwarg.
jgreer013
requested changes
Apr 9, 2026
| class EnvironmentConfig(BaseConfig): | ||
| """Top-level config for environment-first tool definitions.""" | ||
|
|
||
| environments: list[Any] = field(default_factory=list) |
Contributor
There was a problem hiding this comment.
This typing is a bit too weak
Move ToolResult from its own file into base_tool.py alongside Tool and DeterministicToolOutput — all tool-related data types now live in one place. Restore lazy loading of EnvironmentConfig and SynthesisConfig in oumi.core.configs.__init__ to prevent circular imports when oumi.environments is imported first.
Move EnvironmentConfig, BaseEnvironment, and Tool imports behind TYPE_CHECKING in synthesis_config.py since they are only used for type annotations. The single runtime usage of EnvironmentConfig (from_yaml call) uses a local import. Remove the __getattr__ lazy-loading hack from oumi.core.configs.__init__ and restore SynthesisConfig as a normal re-export.
OmegaConf resolves dataclass field annotations at runtime via get_type_hints(). With EnvironmentConfig behind TYPE_CHECKING, the annotation string cannot be resolved, breaking YAML parsing. Use Any for the runtime annotation while keeping the TYPE_CHECKING import for static analysis.
Extract tool parameter and output schemas into a dedicated ToolSchema class with validation and serialization. Update Tool to use ToolSchema for parameters and add optional output_schema field.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
oumi/environments/as a first-class top-level package (alongsideoumi/inference/) for simulated agent environments — usable by synthesis, evaluation, and RLStatefulEnvironment,StatelessEnvironment,DeterministicEnvironment) owns its typed tool subclass (StatefulTool,StatelessTool,DeterministicTool), co-located in the same fileBaseEnvironmentABC with__init_subclass__registry, typed tool coercion, andcreate()factoryBaseToolbase class with common fields; environment-specific fields live only on the relevant subclassDeterministicEnvironment.resolve()andStatelessEnvironment.resolve_cached()/cache_result()— environments own tool execution, not a separate executorEnvironmentConfigas the reusable top-level container, referenced bySynthesisConfig(inline or viaenvironment_config_path)BaseEnvironment.create()requires explicittype,EnvironmentConfig.resolve_tools()raises on unknown idsTest plan
EnvironmentConfigSynthesisConfigSummary by Gitar
oumi/environments/as top-level package withBaseEnvironment,BaseTool, and three typed environment classes (StatefulEnvironment,StatelessEnvironment,DeterministicEnvironment) owning their tool subclasses.EnvironmentConfigfor reusable tool catalogs, integrated intoSynthesisConfigviaenvironment_configorenvironment_config_path; addedMultiTurnAttribute.available_environmentsandavailable_toolsfields.ConversationSynthesizernow acceptsenvironment_config;SynthesisPipelinefilters samples missing required multiturn outputs.BaseEnvironment.create()factory with__init_subclass__registry;EnvironmentConfig.resolve_tools()with strict validation; 40 unit tests for tool params and synthesis config.This will update automatically on new commits.