docs(agent): fix README/API drift — ctx.local, StateAccessor, stream semantics#62
Merged
Conversation
There was a problem hiding this comment.
Perry's Review
Verdict: 💬 Comments / questions
(Posting as COMMENT, not APPROVE: the maintainer GitHub App lacks pull_requests:write on OpenRouterTeam, so Perry cannot record a formal approval here. Content-wise this is an LGTM — docs-only, no action items.)
Details
Accurate docs-only fix. I verified all three drift corrections against source at the PR head:
ctx.local— the tool call context exposeslocal(a getter on the merged context object); the oldctx.contextexample was simply wrong. Corrected.StateAccessor+getState()— thestateoption takes a{ load, save }accessor, and state is read viagetState(). The old(await getResponse()).statewas fiction —getResponse()returns anOpenResponsesResultwith nostatefield. Corrected, and the plain-JSON serverless-resume note is accurate.- Stream semantics —
getToolStream()yieldsdeltaargument events pluspreliminary_resultfor generator tools; execution results (tool.result/tool.call_output) ridegetFullResponsesStream(). Both event names exist in source and the new cheat-sheet table matches the implementation.
The leftover createInitialState import in the Subpath Exports section is correct, not stale — that subpath export still exists. No changes requested.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Three README sections document APIs that don't exist (each cost real debugging time building production agents on the SDK):
ctx?.context.…→ actual API isctx.localstateas mutable value +(await getResponse()).state→ actual API is aStateAccessor({load, save}), read viaresult.getState()getToolStream()yields argument deltas (+ generatorpreliminary_result), not execution events — those are ongetFullResponsesStream()Corrected against source; added a streams cheat-sheet table; StateAccessor example notes plain-JSON serverless resume. Docs-only. Related: SDK-423/SDK-307.