Skip to content

feat(gadgets): add Finish gadget for early agent termination#83

Merged
zbigniewsobiecki merged 1 commit intodevfrom
feat/finish-gadget
Jan 18, 2026
Merged

feat(gadgets): add Finish gadget for early agent termination#83
zbigniewsobiecki merged 1 commit intodevfrom
feat/finish-gadget

Conversation

@zbigniewsobiecki
Copy link
Copy Markdown
Member

Summary

  • Adds a Finish gadget that allows agents to cleanly end their session early
  • Agents call Finish when they've completed all tasks, which throws TaskCompletionSignal from llmist
  • Prevents agents from looping "I have completed the task" until hitting maxIterations

Implementation

  • Created src/gadgets/Finish.ts using the standard Gadget() factory pattern
  • Added Finish to base gadgets in src/agents/base.ts
  • Uses llmist's built-in TaskCompletionSignal for clean termination

Test plan

  • Lint passes (pnpm run lint)
  • TypeScript type check passes (pnpm run typecheck)
  • All tests pass (pnpm test)

🤖 Generated with Claude Code

Agents that complete work before maxIterations had no way to signal
completion, causing them to loop saying "I have completed the task"
until hitting the iteration limit. The Finish gadget allows agents
to cleanly end their session early by throwing TaskCompletionSignal.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@zbigniewsobiecki zbigniewsobiecki merged commit bd7a234 into dev Jan 18, 2026
3 checks passed
zbigniewsobiecki added a commit that referenced this pull request Jan 18, 2026
feat(gadgets): add Finish gadget for early agent termination (#83)
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