Repository navigation
Conversation
Every agent save now runs the runtime's own AgentTemplate.from_params on the configuration it would store, and names each refused field. The change-set engine keys a nameless single-entry tools item (agenta_tools) by its type, and the default agent template seeds skills: []. Split out of the cross-agent tools PR (#7409).
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
… guard a non-text tool type Review round 1: the commit_revision tool maps invalid_agent_configuration to its envelope instead of a 500, the template loader maps the connection refusal too, and a tool entry whose type is not text has no key instead of raising.
Railway Preview Environment
Dependent tests finished. Post /preview for manual review. Environment absence verified; retained storage requires separate provider accounting. Post |
Review round 2: the runtime parse raised TypeError on {"type": []}, so the
save answered 500. The tool parser and the legacy gateway check now treat a
non-text type as an unsupported shape.
|
🤖 The AI agent says: Review loop result for head
Fixed: the |
|
🤖 The AI agent says: Review loop result for head
Fixed: |
|
🤖 The AI agent says: Review loop result for head
Fixed: the template loader maps |
…t tool type before the slug fallback CodeRabbit: an empty @ag.embed skipped the save check, and a tool entry with a non-text type and a gateway slug name parsed as a gateway tool.
|
🤖 The AI agent says: Ship record for head
Commits after the review-loop head: cd5a3e2 (CodeRabbit) checks a template behind an empty Deploy steps: none. |
|
🤖 The AI agent says: Ready for a code review. This PR moves the agent-save checks out of #7409: every agent save runs the runtime's own parse and refuses an unrunnable configuration with a 422 that names the field, the |
Context
An agent could be saved with a configuration that the runtime cannot run. For example, a skill without a
bodysaved with a 200, and after that every run of the agent failed with a 500 and an error that named no field. The save path checked only a few fields (the harness kind, the instructions and the model connection), while the runtime parses the whole agent template withAgentTemplate.from_paramsbefore every run.Two smaller problems sat next to it. The
agenta_toolsentry intoolshas no name, so the operations engine could not address it, and turning on one Agenta tool meant replacing the wholetoolslist. The default agent template also had noskillskey, so the first skill had to be written differently from every later one.These fixes come from pull request 7409. They do not depend on the cross-agent tools, so they ship on their own first.
Changes
Refuse a configuration the runtime cannot run, on every agent save. A new rule,
_reject_unrunnable_agentinapi/oss/src/core/workflows/service.py, runs the runtime's own parse on the configuration that would be stored. It replaces the narrow harness check and runs on every write path: the revision build that every commit goes through, and the simple create and edit paths of workflows, applications and evaluators, before their first write. The rule reads the result, not the change, so an agent stored before this rule with a broken field refuses other changes until the same change fixes that field. Parts that hold an embed are skipped, because embeds resolve only before a run.The refusal is a 422 with the usual agent error envelope, and it names each field:
{ "code": "invalid_agent_configuration", "message": "This agent's setup is not valid, so it cannot run.", "retryable": false, "next_step": "Correct the fields listed in `details.issues` and send the commit again. ...", "details": {"issues": ["parameters.agent.skills[0].body is required"]} }To name the field, the SDK parsers of skills, MCP servers and tools now raise one shared error type,
ConfigEntryErrorinsdks/python/agenta/sdk/agents/config_errors.py. It carries the entry's position and the problems pydantic found inside it. The workflow, evaluator and template loader routes map the refusal to 422, and the agent's owncommit_revisiontool answers with the same envelope. The harness kind refusal (invalid_harness_kind) keeps its code and shape.Key the
agenta_toolsentry by its type. In the operations engine (change_set.py), atoolsentry whose type allows one entry per list is keyed by that type. The set of such types comes from the SDK (SINGLE_ENTRY_TOOL_TYPES, today onlyagenta_tools).Before, the only way to turn on one Agenta tool was to
setthe wholetoolslist. After:{"operation": "set", "target": ["parameters", "agent", {"list": "tools", "key": "agenta_tools"}, "tools", "create_schedule"], "value": "allow"}Seed
skills: []in the default agent template (build_agent_v0_defaultin the SDK), so the first skill is anadd_itemlike every later one.Not release-ready on its own
Not release-ready on its own. This PR is one part of the builder agent. It becomes release-ready only together with the builder agent's UI and its first behavior, which other PRs build. Do not merge it alone.
The PR also adds the builder agent's OpenSpec change (
openspec/changes/builder-agent/), the approved design for the whole program.Tests
test_commit_agent_template_validation.pycovers the refusal on every write path, the field names in the issues, embeds, the bare andprompttemplate shapes, a broken stored agent, and the 422 mapping on each route.test_commit_harness_validation.pynow runs through the new rule.test_change_set.pycovers the keyedagenta_toolsentry.test_config_handlers.pycovers thecommit_revisionanswer.test_config_entry_errors.pycovers the shared entry error. A tool entry whosetypeis not text is now refused as an unsupported shape instead of raising aTypeError.test_default_agent_template.pychecks the seededskills: [].How to review
sdks/python/agenta/sdk/agents/config_errors.py, then the small changes in the skill, MCP and tool parsers that raise it._reject_unrunnable_agentinapi/oss/src/core/workflows/service.py, and its call sites. The simple workflow and application edit paths now read the stored data before the artifact write, so a refused edit writes nothing.InvalidAgentConfigurationErrorintypes.pyand the route mappings._tool_nameinchange_set.py.