Skip to content

Expose shouldStopAfterTurn on Agent - #3

Merged
secemp9 merged 1 commit into
secemp9:masterfrom
xlr8harder:expose-should-stop-after-turn
Jul 28, 2026
Merged

Expose shouldStopAfterTurn on Agent#3
secemp9 merged 1 commit into
secemp9:masterfrom
xlr8harder:expose-should-stop-after-turn

Conversation

@xlr8harder

Copy link
Copy Markdown
Contributor

Summary

  • expose the existing loop-level shouldStopAfterTurn callback through public AgentOptions
  • retain the callback on Agent and forward it into AgentLoopConfig
  • cover the public behavior with a tool turn that records its result, stops, and avoids a second provider call

Why

AgentLoopConfig already supports stopping at a completed turn boundary, but callers of the public Agent API cannot configure that hook. They currently have to subclass Agent and override the private _create_loop_config method.

This keeps the public wrapper aligned with the loop API while preserving the existing ordering: the callback runs after tool execution and prepareNextTurn, and before another provider turn.

Testing

  • uvx ruff check packages/harn_agent/src/harn_agent/agent.py tests/test_agent/test_agent_api.py
  • uv run --all-packages pytest tests/test_agent -q — 83 passed
  • deterministic repository suite — 1377 passed, 2 unrelated environment-sensitive tests deselected
  • uv build --package harn-agent

@secemp9
secemp9 merged commit 0bd413b into secemp9:master Jul 28, 2026
1 check passed
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