Skip to content

Update OpenAI agent max token - #1222

Merged
isamu merged 14 commits into
receptron:mainfrom
isamu:update_openai_agent_max_token
Aug 22, 2025
Merged

isamu merged 14 commits into
receptron:mainfrom
isamu:update_openai_agent_max_token

Conversation

@isamu

@isamu isamu commented Aug 22, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Chores
    • Updated multiple packages and dependencies to their latest patch versions across agents and CLI.
    • Refreshed underlying AI service integrations to maintain compatibility and stability.
    • No user-facing features or behavior changes.

@coderabbitai

coderabbitai Bot commented Aug 22, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Version increments across multiple packages and dependency updates: openai and replicate dependencies in LLM agents, internal package version synchronizations in agents and CLI, and a devDependency bump (typescript-eslint) at the root. No source code or public API changes; all edits are in package.json files.

Changes

Cohort / File(s) Summary of changes
LLM agent dependency upgrades
llm_agents/openai_agent/package.json, llm_agents/replicate_agent/package.json
Bumped package versions (2.0.5→2.0.7; 2.0.0→2.0.1) and upgraded external deps: openai ^5.12.2→^5.15.0, replicate ^1.0.1→^1.1.0.
LLM agent metadata bumps
agents/llm_agents/package.json, llm_agents/openai_fetch_agent/package.json
Version bumps: @graphai/llm_agents 2.0.9→2.0.11; openai_fetch_agent 1.0.0→1.0.1. Updated internal deps in agents/llm_agents: @graphai/openai_agent ^2.0.5→^2.0.7, @graphai/openai_fetch_agent ^1.0.0→^1.0.1, @graphai/replicate_agent ^2.0.0→^2.0.1.
Downstream package syncs
packages/agents/package.json, packages/cli/package.json
Version bumps: packages/agents 2.0.12→2.0.14; packages/cli 2.0.9→2.0.11. Updated deps: @graphai/llm_agents ^2.0.9→^2.0.11; @graphai/agents ^2.0.12→^2.0.14.
Repo tooling
package.json
DevDependency bump: typescript-eslint ^8.39.1→^8.40.0.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • update packages #1175 — Also updates the root devDependency typescript-eslint, indicating parallel tooling maintenance.
  • Update20250813 #1197 — Similar set of version and dependency bumps within LLM agent packages.

Suggested reviewers

  • snakajima

Poem

A bump and a hop through versioned fields,
I nibble on deps as the release wheel yields.
OpenAI, Replicate, carrots aligned,
Packages in sync—so neatly combined.
Thump-thump! The CLI smiles wide—
Another patch; a swift, soft glide. 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@isamu
isamu merged commit 7785448 into receptron:main Aug 22, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c182ce0 and 586a382.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (7)
  • agents/llm_agents/package.json (2 hunks)
  • llm_agents/openai_agent/package.json (2 hunks)
  • llm_agents/openai_fetch_agent/package.json (1 hunks)
  • llm_agents/replicate_agent/package.json (2 hunks)
  • package.json (1 hunks)
  • packages/agents/package.json (2 hunks)
  • packages/cli/package.json (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build (24.x)
  • GitHub Check: build (22.x)
🔇 Additional comments (10)
package.json (1)

26-26: Action Required: Verify lint across all workspaces

The bump to “typescript-eslint@^8.40.0” remains compatible with ESLint 9 (we’re on ESLint ^9.33.0), so the upgrade itself is safe. However, the verification script failed during yarn install due to a sqlite3 build error, preventing the lint step from running. Once the installation issue is resolved, please re-run the workspace linter to catch any renamed rules or stricter defaults:

yarn install --immutable
yarn workspaces run eslint .
llm_agents/replicate_agent/package.json (2)

3-3: Patch version bump to 2.0.1

Semver patch is appropriate for dependency-only update; no concerns.


31-31: Unable to automatically verify the upgrade to replicate@^1.1.0 in our sandbox (native sqlite3 failed to build). Please manually ensure:

  • All imports and type definitions still compile against replicate 1.1.x.

  • Your consumers’ Node.js versions satisfy any new “engines” constraints.

  • The workspace builds and lightweight tests pass:

    yarn install
    yarn workspace @graphai/replicate_agent run b
    yarn workspace @graphai/replicate_agent run test_run
  • Optionally, run a pure type‐check to catch any typing drifts:

    cd llm_agents/replicate_agent
    npx tsc --noEmit
llm_agents/openai_agent/package.json (1)

3-3: Version 2.0.7: PR title mentions “Update OpenAI agent max token,” but this file shows only version/dep bumps

If the “max token” change landed inside the published package code (not shown in this PR), consider referencing the upstream change or changelog in the PR description. Otherwise, this PR does not reflect a direct code change to max token handling.

Please confirm in the changelog of @graphai/[email protected] that the “max token” behavior changed as intended.

llm_agents/openai_fetch_agent/package.json (1)

3-3: Patch bump to 1.0.1

Metadata-only update; LGTM.

agents/llm_agents/package.json (2)

3-3: Version to 2.0.11

Coordinated bump aligns this meta-package with its agent deps; no issues spotted.


32-34: Deps versions confirmed on npm

All three internal agent packages were successfully verified on the npm registry at the specified versions:

  • @graphai/openai_agent@^2.0.7 → 2.0.7
  • @graphai/openai_fetch_agent@^1.0.1 → 1.0.1
  • @graphai/replicate_agent@^2.0.1 → 2.0.1

The subsequent yarn install --immutable failure stems from a native sqlite3 build error in the CI environment and does not affect these agent dependencies. No further action on version availability is required before publishing.

packages/agents/package.json (1)

32-32: Confirm [email protected] includes the OpenAI “max token” update and uses consistent parameter mappings

  • We’ve verified that @graphai/[email protected] depends on @graphai/openai_agent@^2.0.7, which introduced the switch from max_tokens to max_completion_tokens to align with OpenAI’s newer models .
  • Within the llm_agents package, each provider uses the parameter name expected by its underlying API:
    • OpenAI agents (openAIAgent and openAIFetchAgent) use max_completion_tokens (falling back to max_tokens for compatibility).
    • Groq and Anthropic agents continue to use max_tokens.
    • Gemini agent maps our max_tokens input to maxOutputTokens as required by Google’s Vertex AI API.

No mismatches or drift between parameter names were found across these agents.

packages/cli/package.json (2)

3-3: CLI version bump to 2.0.11 is fine; ensure it’s released after agents 2.0.14.

Keeps workspace versions moving forward without API changes. Publish sequencing matters so the CLI can resolve @graphai/agents ^2.0.14 immediately after release.

If you maintain a CHANGELOG for the CLI, add an “Internal: dependency alignment” entry tied to PR #1222.


37-37: Dependency alignment for @graphai/agents ^2.0.14 looks correct—please verify with a smoke type-check/build

A quick build of the CLI workspace will confirm there are no TypeScript definition shifts (this dependency pulls in @graphai/llm_agents@^2.0.11 transitively after the OpenAI SDK bump).

• package needing verification:

  • packages/cli/package.json (dependency line 37)

• Steps to verify:

  • Update your lockfile (e.g. npm install / pnpm install / yarn install)
  • Run the CLI build in your workspace:
    • For pnpm: pnpm -w install --ignore-scripts && pnpm --filter @receptron/graphai_cli build
    • For yarn: yarn install --mode=skip-build && yarn workspace @receptron/graphai_cli run build
    • Adjust commands if you use npm or another manager

Once you’ve confirmed a clean type-check/build with no errors, this change can be approved.

"dependencies": {
"@graphai/llm_utils": "^2.0.3",
"openai": "^5.12.2"
"openai": "^5.15.0"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

openai dep -> ^5.15.0: ensure param name alignment (max_tokens vs max_output_tokens)

Recent OpenAI SDKs emphasize the Responses API which uses max_output_tokens, while legacy Chat Completions uses max_tokens. If your agent switched or abstracts both, verify you set the correct field.

Scan for token-limit fields and OpenAI import style:


🏁 Script executed:

#!/bin/bash
set -euo pipefail
# Look for token limit keys across the repo
rg -nP --type=ts -C2 '\bmax_?output_?tokens\b|\bmax_?tokens\b'
# Ensure no CommonJS require for 'openai' (SDK is ESM-only)
rg -nP "require\\(['\"]openai['\"]\\)"

Length of output: 11362


Ensure OpenAI SDK v5.15.0 parameter names and ESM import style are correct

  • The agent code defines both max_tokens and a custom max_completion_tokens, yet the OpenAI v5 Chat Completion API expects only max_tokens, and the new Responses API uses max_output_tokens. You should:
    • Decide whether you’re calling openai.chat.completions.create (legacy) or openai.responses.create (Responses API)
    • Rename your agent parameter from max_completion_tokens to either max_tokens (for chat completions) or max_output_tokens (for responses) and map it accordingly when building the request payload
    • Remove the deprecated alias in llm_agents/openai_agent/src/openai_agent.ts (lines 22–24) and llm_agents/openai_fetch_agent/src/openai_fetch_agent.ts (lines 11–13), and update the assignment at line 182 (and line 119 in fetch agent) to use the correct field name.

  • Update any test fixtures that still use max_tokens, for example in llm_agents/openai_agent/tests/graphData.ts (line 13), to match the final chosen parameter.

  • The compiled artifacts (lib/openai_agent.js and lib/openai_image_agent.js, both at line 7) are emitting CommonJS require("openai"). Since OpenAI’s SDK v5.15.0 is ESM‐only, you must:
    • Reconfigure your build to output ESM modules (e.g. set module: "ESNext" in tsconfig.json)
    • Or convert those imports to dynamic ESM imports (await import("openai")) so they load correctly at runtime.

🤖 Prompt for AI Agents
In llm_agents/openai_agent/package.json around line 32 and related files, the
project uses OpenAI SDK v5.15.0 (ESM-only) but the agent code mixes deprecated
parameter names and emits CommonJS imports: remove the custom alias
max_completion_tokens and decide which API you call (chat completions or
Responses API); rename the agent parameter to max_tokens (for
chat.completions.create) or max_output_tokens (for openai.responses.create),
update usages and the assignment in llm_agents/openai_agent/src/openai_agent.ts
(remove lines 22–24 and change the assignment at ~line 182) and in
llm_agents/openai_fetch_agent/src/openai_fetch_agent.ts (remove lines 11–13 and
update the assignment at ~line 119), update any test fixtures such as
llm_agents/openai_agent/tests/graphData.ts (line 13) to use the chosen
parameter, and fix ESM import issues by either changing the build to output ESM
modules (e.g., set module: "ESNext" in tsconfig.json) or replacing static
require imports in compiled artifacts with dynamic ESM imports (await
import("openai")) so the SDK loads correctly at runtime.

{
"name": "@graphai/agents",
"version": "2.0.12",
"version": "2.0.14",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Version bump to 2.0.14 looks consistent; confirm release hygiene and publish order.

No code/API changes here. Ensure CHANGELOG entry, git tag, and publish order so that dependents (CLI) resolve this version without race conditions during release.

Run the script below to list all package versions and highlight consumers of @graphai/agents and @graphai/llm_agents across the repo to verify consistency before publishing:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Package versions =="
fd -a package.json -E node_modules | while read -r f; do
  name=$(jq -r '.name // empty' "$f")
  version=$(jq -r '.version // empty' "$f")
  if [[ -n "$name" && -n "$version" ]]; then
    printf "%-50s  %-40s %s\n" "$f" "$name" "$version"
  fi
done | sort

echo
echo "== Dependencies on @graphai/agents and @graphai/llm_agents =="
fd -a package.json -E node_modules | while read -r f; do
  ag=$(jq -r '.dependencies["@graphai/agents"] // empty' "$f")
  llm=$(jq -r '.dependencies["@graphai/llm_agents"] // empty' "$f")
  if [[ -n "$ag" || -n "$llm" ]]; then
    printf "%-50s  agents:%-10s  llm:%s\n" "$f" "$ag" "$llm"
  fi
done | sort

Length of output: 27546


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Locate CHANGELOG file
changelog=$(find . -type f -iname 'CHANGELOG.md' | head -n1)
echo "Changelog file: $changelog"

if [[ -z "$changelog" ]]; then
  echo "No CHANGELOG.md found"
  exit 0
fi

# Check for version entry
echo "Entries for version 2.0.14:"
grep -E "##?\\s*2\\.0\\.14" "$changelog" || echo "No entries for 2.0.14 found"

Length of output: 201


Release 2.0.14: add missing release artifacts and verify publish order

  • No CHANGELOG.md (or equivalent) entry found for version 2.0.14. Please add a section summarizing what’s new in @graphai/[email protected].
  • No Git tag detected for this release. Create and push a tag (e.g. v2.0.14) that matches the version in packages/agents/package.json.
  • To avoid dependency races, publish in this sequence:
    1. @graphai/llm_agents v2.0.11
    2. @graphai/agents v2.0.14
    3. Re-publish the CLI (packages/cli) so it can resolve @graphai/agents@^2.0.14.
  • After the release, verify that all downstream packages resolve the new agent version without errors.
🤖 Prompt for AI Agents
packages/agents/package.json lines 3-3: The release metadata for 2.0.14 is
missing release artifacts and publish steps — add a CHANGELOG.md entry (or
update the project changelog) with a “2.0.14” section summarizing the changes
for @graphai/[email protected], create and push a matching Git tag (e.g. v2.0.14)
pointing to the release commit, publish packages in the required order (first
@graphai/llm_agents v2.0.11, then @graphai/agents v2.0.14, then re-publish the
CLI package) to avoid dependency races, and after publishing verify that
downstream packages resolve @graphai/agents@^2.0.14 without errors.

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