Repository navigation
fix(deps): update openai agents sdk to ^0.21.0 - #192
Conversation
dawsontoth
left a comment
There was a problem hiding this comment.
Typecheck fails, and it's a real API change. @openai/agents-core 0.21.0 (989513a, "preserve bounded nested numeric token usage breakdowns… usage detail values now require narrowing to numbers before arithmetic") makes TokenDetails recursive: { [key: string]: number | TokenDetails }. Our extractCachedTokens / calculateCost in utils/sessions/cost.ts are typed Record<string, number>, hence the 5 TS2345s at runAgentForOnePass.ts:211,320 and cost.ts:153,191,203.
Runtime is unaffected (cached_tokens is still a number), but the types need narrowing. I verified this minimal patch on the branch:
+type TokenDetailsInput = Array<{ [key: string]: unknown }> | { [key: string]: unknown };
...
- inputTokenDetails?: Array<Record<string, number>> | Record<string, number>,
+ inputTokenDetails?: TokenDetailsInput,
...
- if (inputTokenDetail['cached_tokens']) {
- cachedInputTokens += inputTokenDetail['cached_tokens'];
+ const cached = inputTokenDetail['cached_tokens'];
+ if (typeof cached === 'number') {
+ cachedInputTokens += cached;The same type swap is needed in calculateCost and CostTracker.extractCachedTokens. With it, typecheck / build / lint / dprint all exit 0 and 53 files / 345 tests pass (Node 24.21). The other 0.21 break, removal of the Runloop sandbox provider, doesn't touch agent: there are no references. The family moved together as one agents-core@0.21.0 with no split, so the Renovate group rule is working.
61e2b39 to
70ebf76
Compare
@openai/agents-core 0.21 types usage token details as
{ [key: string]: number | TokenDetails }, so cached_tokens can no longer
be added without checking it is a number.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Edited/Blocked NotificationRenovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR. You can manually request rebase by checking the rebase/retry box above. |
|
🎉 This PR is included in version 0.16.86 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This PR contains the following updates:
^0.20.0→^0.21.0^0.20.0→^0.21.0Release Notes
openai/openai-agents-js (@openai/agents)
v0.21.0Compare Source
Patch Changes
4521cf5]989513a]1163b0c]9687b54]7b05470]976579e]980423f]0dd1ef8]Configuration
📅 Schedule: (in timezone America/New_York)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about these updates again.
This PR was generated by Mend Renovate. View the repository job log.