Skip to content

feat(judge): add OpenAI Decisions middleware and runnable examples - #3707

Open
xiaoyuuuuuupeng wants to merge 4 commits into
agentscope-ai:mainfrom
xiaoyuuuuuupeng:feat/openai-decisions-judge
Open

xiaoyuuuuuupeng wants to merge 4 commits into
agentscope-ai:mainfrom
xiaoyuuuuuupeng:feat/openai-decisions-judge

Conversation

@xiaoyuuuuuupeng

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.1.0-SNAPSHOT, tested against main 702a9fca1.

Description

Follow-up to #3648. The existing OpenAI Decisions client returns typed judgments, but applications still need to apply them to the agent loop.

This change adds three opt-in middleware implementations:

  • Select a model once per invocation, with confidence and request-compatibility checks.
  • Score optional tools independently on each reasoning step, preserve essential tools, and retain the original schemas on ambiguous results.
  • Assess guarded tool calls before dispatch. Failures and refusals deny by default; passing the assessment still goes through core permissions. Denials produce tool-result messages and events.

All three are disabled by default. Configurable wrapper retries are bound through the existing Spring Boot starter, preserving zero retries by default. Borrowed SDK clients retain their own lifecycle and retry settings.

Add a runnable example with independent route, select, and guard modes, simulated business tools, and aligned EN/ZH documentation. The example configures reasoning_effort=none for Luna chat requests so function tools work through Chat Completions. It also documents JVM proxy setup and SDK daemon-thread warnings under exec:java.

Broader JEV execution modes, confirmation binding, RAG, compaction, evaluation, and Service wiring are outside this PR.

Validation on Java 17 / Maven 3.6.3 / Windows:

  • mvn -B -T1C clean verify: all 110 tests in the Decisions extension (96), starter (7), and example (7) pass, including request-body regression coverage for Luna tool calls. These modules complete verification, including formatting and Javadoc checks.
  • The full reactor fails in unmodified Harness: WorkspaceMessageBusTest.logReadWithCursor reports a JUnit temporary-directory cleanup DirectoryNotEmptyException. Harness totals: 1,300 tests, 0 assertion failures, 1 cleanup error, 18 skips. The exact method passes on isolated rerun; the full reactor remains non-green and dependent modules are skipped.
  • Provider credentials were removed from the verification subprocess environment, so credential-gated live-provider tests were not exercised.
  • Module/BOM synchronization and git diff --check pass.
  • Documentation: 13 tests pass; validation passes for 432 pages and 584 redirects, including the Mintlify build. Broken-link checking reports 2,218 links in 326 files; all 2,544 file/link entries match the previously captured upstream baseline, with no additions.
  • The contributor's manual select run completes with live Decisions and Chat Completions, a simulated weather-tool result, and BUILD SUCCESS. Live routing, guarding, image input, retries, and production decision quality have not been validated.

AI assistance: implementation and local verification used Codex.

Checklist

  • Code has been formatted with mvn spotless:apply
  • All tests are passing — focused modules pass; full-reactor failure is listed above
  • Javadoc comments follow project conventions
  • Related documentation and examples have been updated
  • Code is ready for review — draft pending review of the full-reactor failure

@mintlify

mintlify Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 11c74f6.

Approve preview

@xiaoyuuuuuupeng
xiaoyuuuuuupeng marked this pull request as ready for review October 21, 2026 10:37

This branch has not been deployed

No deployments
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.

1 participant