Skip to content

Experiment: use a structured finish answer for Stirrup - #496

Closed
ShuxinLin wants to merge 22 commits into
IBM:mainfrom
ShuxinLin:experiment/stirrup-custom-finish-tool
Closed

Experiment: use a structured finish answer for Stirrup#496
ShuxinLin wants to merge 22 commits into
IBM:mainfrom
ShuxinLin:experiment/stirrup-custom-finish-tool

Conversation

@ShuxinLin

@ShuxinLin ShuxinLin commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • replace Stirrup's default finish(reason, paths) contract with an AssetOps-specific finish(answer, reason, paths) tool
  • require a non-empty final response and instruct the model to match the output format requested in the original question
  • treat the validated structured finish answer as authoritative instead of inferring the answer from assistant prose or finish.reason
  • remove the Stirrup post-run answer-repair module and second LLM call
  • remove answer_repair trajectory persistence and the evaluator's --answer-field selection; evaluation now always scores answer
  • preserve upstream-style validation for reported output paths

Motivation

The default Stirrup finish tool only returns a completion reason, which may be a status summary such as "the task was completed" rather than the response requested by the user. Stirrup 0.1.12 supports custom finish tools, so the response contract can be enforced directly when the agent terminates.

With the structured finish contract, a separate repair pass and duplicate trajectory field are unnecessary. Persisted trajectories return to a single source of truth:

{
  "answer": "<validated finish answer or legacy final-answer fallback>"
}

Behavior

  • the tool remains named finish, preserving Stirrup termination behavior and trajectory compatibility
  • answer is required and rejects empty or whitespace-only values
  • answer is the complete response sent directly to the user and must follow the requested output format without status updates, internal reasoning, or extra commentary unless requested
  • reason is optional operational metadata explaining why the run is ending and is not used as the primary response
  • paths optionally lists individual files created or modified for the user
  • final_answer() prefers finish_params.answer, then retains the existing legacy assistant-text and finish.reason fallbacks
  • the custom executor returns the final response as the finish tool result and rejects nonexistent reported files when a code execution environment is active
  • Stirrup persists only answer; no repair model call or answer_repair field remains
  • offline evaluation always reads the trajectory's answer field

Removed surface

  • src/agent/stirrup_agent/answer_repair.py
  • Stirrup answer-repair tests and runner integration
  • optional answer_repair support in trajectory persistence
  • evaluator answer_field configuration
  • CLI --answer-field option
  • related tests and documentation

Testing

  • direct Stirrup loop smoke test verifies the custom schema is exposed, the finish call terminates the run, and AssetOpsFinishParams is returned
  • runner tests verify structured and legacy completion persist the selected answer
  • uv run pytest src/agent/stirrup_agent/tests src/observability/tests src/evaluation/tests src/benchmark/tests -q — 188 passed
  • uv run python -m compileall -q src/agent/stirrup_agent src/observability src/evaluation
  • git diff --check

Dependency

This is an experimental stacked PR based on #493. GitHub will show the parent branch changes in this PR until #493 merges into main; the custom finish experiment begins at commit 9515098, and answer repair is removed by commit 56e8e37.

ShuxinLin and others added 22 commits July 29, 2026 12:25
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
…mpt guidelines, and refresh benchmark scenario suites

Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Chathurangi Shyalika <chathurangishyalika@Chathurangis-MacBook-Pro.local>
Signed-off-by: Chathurangi Shyalika <chathurangijks@gmail.com>

Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
Signed-off-by: Shuxin Lin <linshuhsin@gmail.com>
@ShuxinLin

Copy link
Copy Markdown
Collaborator Author

The custom finish-tool experiment has been fast-forwarded into the parent branch and is now part of #493. Closing this draft as superseded.

@ShuxinLin ShuxinLin closed this Jul 30, 2026
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.

2 participants