Skip to content

Fix Python session.send docs examples#1312

Merged
stephentoub merged 1 commit into
mainfrom
stephentoub/fix-issue-1127
May 16, 2026
Merged

Fix Python session.send docs examples#1312
stephentoub merged 1 commit into
mainfrom
stephentoub/fix-issue-1127

Conversation

@stephentoub
Copy link
Copy Markdown
Collaborator

Several Python docs examples showed the Node/TypeScript session.send({ prompt: ... }) shape even though the Python SDK expects the prompt as a positional string. Following those examples could send a JSON object as the prompt and surface a CLI session.error.

This updates the Python BYOK and steering/queueing examples to use session.send("...") with mode= passed as a keyword argument where needed. TypeScript examples are left unchanged because the object form is correct for that SDK.

Fixes #1127

Update Python documentation examples to pass the prompt string positionally and use keyword arguments for mode, matching the current Python SDK API.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 16, 2026 18:42
@stephentoub stephentoub requested a review from a team as a code owner May 16, 2026 18:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR corrects Python documentation examples to match the Python SDK’s CopilotSession.send(prompt: str, *, mode=...) API shape, avoiding cases where users copy examples that accidentally send a JSON object as the prompt and trigger CLI session.error failures (per #1127).

Changes:

  • Update Python BYOK example to call await session.send("...") instead of passing { "prompt": ... }.
  • Update Python steering/queueing examples to use positional prompt strings and mode="immediate" / mode="enqueue" keyword arguments.
  • Leave Node.js/TypeScript examples unchanged (object form is correct for that SDK).
Show a summary per file
File Description
docs/features/steering-and-queueing.md Fix Python steering/queueing snippets to use session.send("...") with mode= keyword arg.
docs/auth/byok.md Fix Python BYOK snippet to pass the prompt as a positional string to session.send().

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

@stephentoub stephentoub merged commit 31ea472 into main May 16, 2026
19 checks passed
@stephentoub stephentoub deleted the stephentoub/fix-issue-1127 branch May 16, 2026 18:47
@stephentoub stephentoub restored the stephentoub/fix-issue-1127 branch May 16, 2026 18:47
@stephentoub stephentoub deleted the stephentoub/fix-issue-1127 branch May 16, 2026 18:48
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.

[Bug] session.error with t.asString is not a function when using session.send() with BYOK provider

3 participants