Skip to content

feat: expose taskBudget SDK option as task_budget action input#1376

Open
rsd-darshan wants to merge 1 commit into
anthropics:mainfrom
rsd-darshan:expose-task-budget-sdk-option
Open

feat: expose taskBudget SDK option as task_budget action input#1376
rsd-darshan wants to merge 1 commit into
anthropics:mainfrom
rsd-darshan:expose-task-budget-sdk-option

Conversation

@rsd-darshan

@rsd-darshan rsd-darshan commented Jun 2, 2026

Copy link
Copy Markdown

Summary

Closes #1329.

The SDK has supported taskBudget since v0.2.84 but there was no way to set it from the action layer — passing --task-budget via claude_args was silently ignored because the CLI doesn't recognise that flag.

  • Added task_budget input to both action.yml and base-action/action.yml
  • Added taskBudget?: string to ClaudeOptions in base-action/src/run-claude.ts
  • Wired it through parseSdkOptions as sdkOptions.taskBudget = { total: parseInt(...) } (same pattern as maxTurns)
  • Passed INPUT_TASK_BUDGET env var from both action entrypoints (base-action/src/index.ts and src/entrypoints/run.ts)

Test plan

  • Set task_budget: 200000 in a workflow using this action and confirm the SDK receives taskBudget: { total: 200000 } (visible in step debug output with show_full_output: true)
  • Omitting task_budget leaves the field undefined — no change in existing behaviour
  • Passing a non-numeric value is handled the same way as maxTurns (parseInt produces NaN, SDK rejects it at runtime)

Wires the SDK's taskBudget.total option through the full stack so users
can set an API-side token budget from the action layer. Previously the
option was silently ignored even though the SDK has supported it since
v0.2.84.
@rsd-darshan

Copy link
Copy Markdown
Author

Hey @brianatdetections — this PR implements Option B from your request. The task_budget input is wired directly to sdkOptions.taskBudget = { total: parseInt(...) } so the SDK sends the task-budgets-2026-03-13 beta header automatically. Would appreciate a quick test against your setup to confirm it behaves as expected before this gets merged.

@brianatdetections

Copy link
Copy Markdown

Hey @brianatdetections — this PR implements Option B from your request. The task_budget input is wired directly to sdkOptions.taskBudget = { total: parseInt(...) } so the SDK sends the task-budgets-2026-03-13 beta header automatically. Would appreciate a quick test against your setup to confirm it behaves as expected before this gets merged.

Thanks! Will update and test later this week, looks good though.

@brianatdetections

Copy link
Copy Markdown

This is ready for maintainer review. I verified all CI checks pass locally against the PR head (0bda0e8):

Check Result
bun run typecheck ✅ pass (tsc --noEmit)
bun run format:check ✅ pass (all files match Prettier style)
bun test ✅ 700 passed / 0 failed (39 files)

The change is minimal (16 lines, no deletions) and mirrors the existing maxTurns wiring end-to-end. The one thing worth calling out: it assigns taskBudget: { total: parseInt(...) } into the SDK Options type, and the pinned SDK (@anthropic-ai/claude-agent-sdk@0.3.173) declares exactly that shape — taskBudget?: { total: number } (sdk.d.ts:1587, marked @alpha) — so it typechecks cleanly.

Closes #1329.

@ashwin-ant — since this is an external PR, CI is held pending a maintainer "Approve and run workflows", and the approvals so far are from non-write accounts so they don't satisfy branch protection. Could you approve the workflow run and take a review pass when you get a chance? Happy to address anything.

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.

Expose claude-agent-sdk taskBudget option (API-side budget awareness)

2 participants