Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

feat(grok): raise the contract to 256 tool calls and 1024 messages

Alfredo Lopez8e12900e6315
diff --git a/docs/architecture/grok-subscription-transport-contract.md b/docs/architecture/grok-subscription-transport-contract.md
index e3a3ede01..017f68631 100644
--- a/docs/architecture/grok-subscription-transport-contract.md
+++ b/docs/architecture/grok-subscription-transport-contract.md
@@ -120,8 +120,12 @@ an error.
## Limits
-Owned by `@clerum/grok-provider-attempt-contract`. Independent of Codex
-`LIMITS` (`maxToolCalls` is 64 for Grok and 256 for Codex; `maxMessages` is 128 for Grok and 1024 for Codex).
+Owned by `@clerum/grok-provider-attempt-contract`, a separate module from Codex
+`LIMITS` but carrying the same values: `maxToolCalls` 256 and `maxMessages`
+1024, in the 1:4 ratio a turn of N calls needs (N calls add N+1 messages). All
+three enforcement points read this module — the control-api authorizer,
+`grok-llm-proxy` and the Host — so a deployment that mixes versions rejects
+requests between the old and new bounds with `invalid_request`.
Proxy robustness (both proxies):
diff --git a/packages/grok-provider-attempt-contract/index.cjs b/packages/grok-provider-attempt-contract/index.cjs
index 1f5c69a29..b1bbb9cc6 100644
--- a/packages/grok-provider-attempt-contract/index.cjs
+++ b/packages/grok-provider-attempt-contract/index.cjs
@@ -18,10 +18,13 @@ const CATALOG_ORIGIN = 'https://cli-chat-proxy.grok.com/v1/models'
const LIMITS = Object.freeze({
maxRequestBodyBytes: 1048576,
- maxMessages: 128,
- // Independent of Codex, which is 256 since fba84cb34. Exceeding this is
- // reported as `tool_call_limit_exceeded`, not as a provider outage.
- maxToolCalls: 64,
+ maxMessages: 1024,
+ // Bound calls in each assistant message independently of advertised
+ // definitions. A turn of N calls adds N+1 messages, so N stays <=
+ // maxMessages/4. At this bound maxOutputTokens leaves 64 output tokens per
+ // call in one response. Exceeding it is reported as
+ // `tool_call_limit_exceeded`, not as a provider outage.
+ maxToolCalls: 256,
maxOutputTokens: 16384,
maxDeadlineMs: 300000,
maxIdLength: 128,
diff --git a/packages/grok-provider-attempt-contract/index.d.ts b/packages/grok-provider-attempt-contract/index.d.ts
index 8f0af12ed..f50b4cee9 100644
--- a/packages/grok-provider-attempt-contract/index.d.ts
+++ b/packages/grok-provider-attempt-contract/index.d.ts
@@ -16,8 +16,8 @@ export declare const CATALOG_ORIGIN: 'https://cli-chat-proxy.grok.com/v1/models'
export declare const LIMITS: {
readonly maxRequestBodyBytes: 1048576
- readonly maxMessages: 128
- readonly maxToolCalls: 64
+ readonly maxMessages: 1024
+ readonly maxToolCalls: 256
readonly maxOutputTokens: 16384
readonly maxDeadlineMs: 300000
readonly maxIdLength: 128
diff --git a/tests/e2e/fixtures/grok-subscription/sanitized-upstream-contract.json b/tests/e2e/fixtures/grok-subscription/sanitized-upstream-contract.json
index 2a68126fe..b6b27622c 100644
--- a/tests/e2e/fixtures/grok-subscription/sanitized-upstream-contract.json
+++ b/tests/e2e/fixtures/grok-subscription/sanitized-upstream-contract.json
@@ -55,8 +55,8 @@
},
"limits": {
"maxRequestBodyBytes": 1048576,
- "maxMessages": 128,
- "maxToolCalls": 64,
+ "maxMessages": 1024,
+ "maxToolCalls": 256,
"maxOutputTokens": 16384,
"maxStreamDurationMs": 300000,
"maxDeadlineMs": 300000,
diff --git a/tests/e2e/fixtures/package-lock.json b/tests/e2e/fixtures/package-lock.json
index 17b402c80..27ae31092 100644
--- a/tests/e2e/fixtures/package-lock.json
+++ b/tests/e2e/fixtures/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.86",
+ "version": "1.0.87",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.86",
+ "version": "1.0.87",
"dependencies": {
"@kubernetes/client-node": "^1.0.0"
},
diff --git a/tests/e2e/fixtures/package.json b/tests/e2e/fixtures/package.json
index a38efcff1..1835ae0ad 100644
--- a/tests/e2e/fixtures/package.json
+++ b/tests/e2e/fixtures/package.json
@@ -1,6 +1,6 @@
{
"name": "@clerum/e2e-test-fixtures",
- "version": "1.0.86",
+ "version": "1.0.87",
"description": "E2E test fixtures and utilities for Clerum testing",
"type": "module",
"main": "index.ts",