Skip to content

Add schema-aware custom-agent outputs#3684

Merged
DavidBakerEffendi merged 7 commits into
masterfrom
3683-support-schema-constrained-custom-agent-outputs
May 27, 2026
Merged

Add schema-aware custom-agent outputs#3684
DavidBakerEffendi merged 7 commits into
masterfrom
3683-support-schema-constrained-custom-agent-outputs

Conversation

@DavidBakerEffendi

@DavidBakerEffendi DavidBakerEffendi commented May 27, 2026

Copy link
Copy Markdown
Collaborator

Description

Adds an explicit callCustomAgentWithSchema path for schema-constrained child agents while preserving legacy callCustomAgent behavior. The child agent validates schemas, runs its normal tool loop, and makes one final structured-answer call when a schema is supplied.

The schema-aware tool no longer depends on the parent model copying a large schema object exactly. It accepts a full schema object, a schema name string, or a partial {name, schema:{}} reference, then resolves the full validated schema from the parent task text before dispatch.

Key Changes:

  • Added schema-aware custom-agent execution and parallel handling so each child can return one structured result without falling back to Markdown.
  • Wired schema validation and structured final-answer calls through CustomAgentExecutor, CustomAgentTools, and ParallelCustomAgent.
  • Resolved schema references server-side for brittle parent-model tool calls, including schema-name and empty-schema-object references.
  • Gated callCustomAgentWithSchema exposure on model JSON-schema support and kept schema-aware child failures as hard failures.
  • Let SearchAgent run read-only custom-agent batches through ParallelCustomAgent, including schema-aware specialist flows.
  • Expanded test coverage for final structured output, invalid schema rejection, unsupported-model failures, schema-reference resolution, and parallel child execution.

Touch Points:

  • app/src/main/java/ai/brokk/agents/ArchitectAgent.java
  • app/src/main/java/ai/brokk/agents/LutzAgent.java
  • app/src/main/java/ai/brokk/agents/SearchAgent.java
  • app/src/main/java/ai/brokk/executor/agents/CustomAgentExecutor.java
  • app/src/main/java/ai/brokk/executor/agents/CustomAgentResponseSchemaResolver.java
  • app/src/main/java/ai/brokk/executor/agents/CustomAgentTools.java
  • app/src/main/java/ai/brokk/executor/agents/ParallelCustomAgent.java
  • app/src/main/java/ai/brokk/mcpserver/BrokkExternalMcpServer.java
  • app/src/test/java/ai/brokk/agents/SearchAgentTest.java
  • app/src/test/java/ai/brokk/executor/agents/CustomAgentExecutorTest.java
  • app/src/test/java/ai/brokk/executor/agents/ParallelCustomAgentTest.java

Summary

  • Introduces an explicit schema-aware custom-agent path for SlopCop-style batched specialist flows.
  • Keeps the existing Markdown/string callCustomAgent path unchanged.
  • Treats schema failures and unsupported schema-capable models as hard failures for the child execution path.
  • Avoids brittle large-schema copying by resolving schema references inside Brokk before child execution.

Testing

  • ./gradlew :app:test --tests ai.brokk.executor.agents.ParallelCustomAgentTest --tests ai.brokk.executor.agents.CustomAgentExecutorTest --tests ai.brokk.agents.SearchAgentTest --tests ai.brokk.agents.LutzAgentTest
  • ./gradlew fix tidy
  • ./gradlew analyze

@DavidBakerEffendi DavidBakerEffendi linked an issue May 27, 2026 that may be closed by this pull request
@DavidBakerEffendi
DavidBakerEffendi merged commit d20fbdf into master May 27, 2026
5 checks passed
@DavidBakerEffendi
DavidBakerEffendi deleted the 3683-support-schema-constrained-custom-agent-outputs branch May 27, 2026 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support schema-constrained custom-agent outputs

1 participant