[PR #374] [MERGED] Expose agent token budget settings #4589

Closed
opened 2026-10-22 04:08:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/374
Author: @TheLonelyDevil9
Created: 5/3/2026
Status: ✅ Merged
Merged: 5/3/2026
Merged by: @TheLonelyDevil9

Base: main ← Head: fix-agent-token-budget-ui


📝 Commits (3)

  • e03239c Expose agent token budget settings
  • 47b5693 Merge branch 'main' into fix-agent-token-budget-ui
  • 58d1126 Address agent token budget review feedback

📊 Changes

7 files changed (+254 additions, -77 deletions)

View changed files

📝 packages/client/src/components/agents/AgentEditor.tsx (+87 -25)
📝 packages/client/src/components/chat/ChatSettingsDrawer.tsx (+96 -34)
📝 packages/server/src/routes/generate/retry-agents-route.ts (+2 -1)
📝 packages/server/src/services/agents/agent-executor.ts (+30 -16)
📝 packages/server/src/services/llm/base-provider.ts (+12 -0)
📝 packages/server/test/context-fit.test.ts (+19 -0)
📝 packages/shared/src/types/agent.ts (+8 -1)

📄 Description

Summary

  • Adds an Agent Budget section to the Agent Editor and Add Agent modal with a visible Max Output Tokens setting alongside context size.
  • Replaces the hidden 16k agent output floor with the configured per-agent budget, while still respecting connection-level max token overrides.
  • Updates context fitting to reduce oversized completion budgets before trimming otherwise-fitting agent prompts, preventing logs like budget ~128, maxContext=8192 from dropping agent context unnecessarily.

Testing

  • pnpm --filter @marinara-engine/server test
  • pnpm --filter @marinara-engine/client build
  • pnpm --filter @marinara-engine/shared build
  • pnpm --filter @marinara-engine/server build
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Per-agent "Max Output Tokens" setting and an "Agent Budget" section in the editor and add-agent UI.
  • Improvements

    • Numeric inputs normalized/clamped to safe bounds; provider overrides applied when computing budgets.
    • Default context sizing applied and batch budget aggregation refined.
    • Built-in agents now initialize with sensible max-token defaults.
  • Tests

    • Added a test ensuring output budget is reduced before trimming messages.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/374 **Author:** [@TheLonelyDevil9](https://github.com/TheLonelyDevil9) **Created:** 5/3/2026 **Status:** ✅ Merged **Merged:** 5/3/2026 **Merged by:** [@TheLonelyDevil9](https://github.com/TheLonelyDevil9) **Base:** `main` ← **Head:** `fix-agent-token-budget-ui` --- ### 📝 Commits (3) - [`e03239c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e03239ce2c0e26f59c7d20e8720baa5103459a97) Expose agent token budget settings - [`47b5693`](https://github.com/Pasta-Devs/Marinara-Engine/commit/47b56931d9034acb2458c551ba63f6bae3fa869f) Merge branch 'main' into fix-agent-token-budget-ui - [`58d1126`](https://github.com/Pasta-Devs/Marinara-Engine/commit/58d11262aeb125b367bad39101598a09f6f5f6cc) Address agent token budget review feedback ### 📊 Changes **7 files changed** (+254 additions, -77 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/agents/AgentEditor.tsx` (+87 -25) 📝 `packages/client/src/components/chat/ChatSettingsDrawer.tsx` (+96 -34) 📝 `packages/server/src/routes/generate/retry-agents-route.ts` (+2 -1) 📝 `packages/server/src/services/agents/agent-executor.ts` (+30 -16) 📝 `packages/server/src/services/llm/base-provider.ts` (+12 -0) 📝 `packages/server/test/context-fit.test.ts` (+19 -0) 📝 `packages/shared/src/types/agent.ts` (+8 -1) </details> ### 📄 Description ## Summary - Adds an Agent Budget section to the Agent Editor and Add Agent modal with a visible Max Output Tokens setting alongside context size. - Replaces the hidden 16k agent output floor with the configured per-agent budget, while still respecting connection-level max token overrides. - Updates context fitting to reduce oversized completion budgets before trimming otherwise-fitting agent prompts, preventing logs like `budget ~128, maxContext=8192` from dropping agent context unnecessarily. ## Testing - `pnpm --filter @marinara-engine/server test` - `pnpm --filter @marinara-engine/client build` - `pnpm --filter @marinara-engine/shared build` - `pnpm --filter @marinara-engine/server build` - `git diff --check` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Per-agent "Max Output Tokens" setting and an "Agent Budget" section in the editor and add-agent UI. * **Improvements** * Numeric inputs normalized/clamped to safe bounds; provider overrides applied when computing budgets. * Default context sizing applied and batch budget aggregation refined. * Built-in agents now initialize with sensible max-token defaults. * **Tests** * Added a test ensuring output budget is reduced before trimming messages. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:08:57 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4589
No description provided.