Conversation
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.
Overview
Simplify Code Mode so it orchestrates an agent's currently active tools without requiring a second tool registration list or duplicating their JSON schemas in the model context. Optional capabilities are now ordinary Python utility functions that add functionality outside the agent tool catalog.
Architecture and critical paths
create_codemode_tool()resolves active external tools from the executing harness on every invocation. Core agent tools, inactive lazy tools, and all Code Mode instances are excluded. Utility/tool name collisions fail explicitly.HarnessTool.execute()for schema and Pydantic validation, returning complete JSON-mode outputs. Plain sync/async utility functions use Python signature binding and share the existing result serialization, size limits, usage accounting, and sanitized nested audit events.codemodeconvenience tool now shares the factory implementation while retaining automatic remote/local selection. The factory retains fail-closed remote execution by default, execution admission control, runtime/memory limits, and the exactly-onceoutput(value)contract.ALLOWED_GLOBAL_MODULESregistry supplies worker globals, attribute guards, reserved names, and the description's module list. It includesre,math,statistics,itertools, anddecimal. Safe public attributes are available on approved modules and their classes/instances, with exact type-module checks and RestrictedPython's attribute protections.list,dict,str, andtuple) support ordinary public methods and constructors without exposing the entire builtins module. Item assignment/deletion is restricted to plain lists and dictionaries; private attributes, unsafe string formatting, and module/class writes remain blocked.agent_idas an ordinary argument without changing legacy published-agent routing behavior.API changes
CodeModeCapability, result adapter APIs, andToolInheritancePolicy.capabilities=[...]for additional utilities.Documentation and regression coverage are updated for active/lazy tools, child harness dispatch, sync/async utilities, serialized return shapes, container operations, module access, argument preservation, and the existing execution safeguards. Live read-only Facilities Maintenance Demo runs exercised Code Mode with real queries, list/dict mutations, statistics, and decimal rounding; the verified snapshot contains 20 work orders with a 50.00% completion rate.