Skip to content

docs(sdk): add ask-human tool example - #161

Draft
MagMueller wants to merge 1 commit into
mainfrom
poke-custom-tool
Draft

docs(sdk): add ask-human tool example#161
MagMueller wants to merge 1 commit into
mainfrom
poke-custom-tool

Conversation

@MagMueller

@MagMueller MagMueller commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

What changed

Adds a host-supplied callback recipe for an ask_human tool requested by an integration partner. The example wraps the host callback in a typed SDK tool and shows scoped registration through opencode.tools.register.

Verification

  • bun test test/ask-human-example.test.ts: 1 passed, 0 failed
  • bun run typecheck: passed
  • git diff --check: passed

The public example does not name or quote the private partner conversation.


Summary by cubic

Documents how to register a host callback as an agent tool in @opencode-ai/sdk-next with a new ask_human example. Previously the README described tool registration but gave no concrete callback-based tool; now it shows a complete pattern hosts can copy.

  • Adds makeAskHuman in packages/sdk-next/examples/ask-human.ts, which wraps a (question: string) => Promise<string> callback in a typed Tool and maps failures to a Tool.Failure.
  • Adds packages/sdk-next/test/ask-human-example.test.ts, which settles the tool with a host answer and asserts the callback receives the question.
  • Links the example from the README directly after the tools.register(...) snippet.

Written for commit 7a0e9b3. Summary will update on new commits.

Review in cubic

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