feat: replace positional tools array with named tool_config dict#398
Open
Davsooonowy wants to merge 24 commits into
Open
feat: replace positional tools array with named tool_config dict#398Davsooonowy wants to merge 24 commits into
Davsooonowy wants to merge 24 commits into
Conversation
…runtime_arguments
Replace the positional tools list with a named tool_config dict (keyed by tool NAME) throughout the serializer, view, and preconfiguration service layers. Also fix a circular import in enthusiast-common caused by agents/config.py importing AgentConfig at module load time.
Rename CONFIGURATION to CONFIGURATION_ARGS on DummyTool, DummyTool2, and NoConfigTool in test_fields.py, and update all tool_field_name arguments to match the real BaseTool attribute name used in production. Add test_verifyagents_command_missing_tool_name_in_tool_config to cover the branch where a required tool key is entirely absent from tool_config.
Replace bare DummyTool class references with FunctionToolConfig(tool_class=DummyTool) in two tests so fixtures are structurally correct and guard-order-independent. Also add blank lines to separate Arrange/Act/Assert sections in test_verifyagents_command_missing_tool_name_in_tool_config.
…oolListField, broaden verifyagents exception handling
- fields.py: wrap unknown-tool error in a list so DRF serialises it correctly - form-utils.ts: use raw section key instead of sectionMapping alias in tool_config branch - verifyagents.py: catch AttributeError alongside ValidationError and TypeError - test_fields.py: assert unknown-tool error is a list
…IGURATION_ARGS - agents.ts: use ExtraArgDetail instead of string for tool_config values, consistent with AgentConfig in types.ts - fields.py: include all named tools in tool_map regardless of CONFIGURATION_ARGS; tools without a schema are accepted silently instead of raising Unknown tool - test_fields.py: update test to assert silent acceptance instead of error
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
StopExecutionToolis appended to the tool list at runtime but had no corresponding entry in the positionaltoolsarray stored in DB config — causing an index-out-of-range crash. Named lookup silently skips tools with no config entry.tool_config: {"tool_name": {...}}(keyed bytool.NAME) instead oftools: [{...}, {}](positional array). Order of tools in the runtime list no longer matters.tool_config, including flatten/unflatten, default values, build-back to API payload, and server error mapping.Changes
Backend:
BaseAgent.set_runtime_arguments— namedtool_config.get(tool.NAME)lookup replaces positional index loopAgentPreconfigurationService._build_default_agent_configuration— buildstool_configdict (skips tools with noCONFIGURATION_ARGS)PydanticModelToolConfigFieldvalidates dict-keyed tool config against each tool's Pydantic schemaAgentConfigSerializer+AgentChoiceSerializer+AgentTypesViewupdated to usetool_configverifyagentsmanagement command updated to validate by name instead of indexFrontend:
AgentConfigandAgentChoicetypes updated (tool_configdict replacestoolsarray)flattenConfigForFormhandles 2-leveltool_confignesting →tool_config_${toolName}_${fieldName}flat keysBreaking Change
No DB migration. Existing agent configs with the old
tools: [...]format are incompatible. Agents must be re-preconfigured after deploy (run./manage.py preconfiguregentsor equivalent).