An agentic browser harness: an AI side panel & orb in your own logged-in Chrome, Edge, Arc, Brave or even Firefox run by the agent/subscription you already use (Claude Code, Codex, Antigravity). Free, open source, no API key. Also an MCP server.
TypeScript agentic-browseragentic-browsingagy-cliaiai-agentai-browser-extensionai-toolsbrave-extensionbrowser-agentbrowser-automationbrowser-extensionbrowser-usebrowserskillchrome-extensionclaude-codecodexfirefox-addonmcp-servernanobrowserweb-automation
fix(agents): let a Codex run read a tool result whole up to 25,000 tokens, because tool_output_token_limit does raise the cut the docs said no flag could
Shahriar24011cf9d05b
diff --git a/docs/guide/agents.md b/docs/guide/agents.mdindex f775316..37f3ac4 100644--- a/docs/guide/agents.md+++ b/docs/guide/agents.md@@ -64,9 +64,10 @@ and it is told to read the page rather than recall it. Web search is switched of[mapping a site](features/site-maps.md), and sub-agents, goal memory, connector apps and plugin suggestionsare switched off for good measure.-One thing Browsentic cannot change: **Codex cuts any tool result longer than about 10,000 tokens**,-which a whole-page snapshot can pass. The prompt asks for smaller reads, but on a dense page expect-Codex to see less of it than the other agents do.+**Codex cuts a tool result at 10,000 tokens** by default, which a whole-page snapshot can pass.+Browsentic raises that to 25,000, the ceiling Claude Code puts on the same result. A code-mode model+also has to ask for it at the top of every `exec` script, which the prompt tells it to do. A result+past 25,000 is still cut, so the prompt asks for smaller reads too.### Mistral Vibe is in beta@@ -150,7 +151,7 @@ Claude runner's settings.| `AGENT_NEEDS_PERMISSION` | Antigravity has no rule for Browsentic's tools: press the button, or `browsentic agent fix antigravity`. Grok Build is not signed in: run `grok login`. || Codex: "not logged in" | The daemon inherits no session. Run `codex login`, then retry. || Codex answers about the page without opening it, or from a web search | Update Browsentic. Codex hides the browser tools until the model searches for them, and an older Browsentic left Codex's own web search switched on, which the model reached for first. |-| Mistral Vibe: a follow-up turn says *this agent run is no longer active* | Update Browsentic. An older one gave each turn its own folder, and Vibe kept re-reading the first turn's. |+| Mistral Vibe: a follow-up turn says *this agent run is no longer active* | Update Browsentic, then start a new conversation. An older one gave each turn its own folder, and Vibe keeps re-reading the first turn's, so a conversation begun before the update stays broken. || "does not understand the flags Browsentic uses" | The CLI is too old. Update it. || Antigravity answers but never touches the page | Its permission rule was removed. `browsentic agent` reports *needs setup* again. || Grok Build sits silent for minutes, then *xAI did not answer* | The Grok account is rate-limited — a free one usually is. Wait, or upgrade the account. |diff --git a/docs/guide/troubleshooting.md b/docs/guide/troubleshooting.mdindex 3cbc3b6..4c103c9 100644--- a/docs/guide/troubleshooting.md+++ b/docs/guide/troubleshooting.md@@ -58,8 +58,8 @@ Those three answer most questions. The daemon log also lives at `~/.browsentic/d| Antigravity answers but never touches the page | Its permission rule was removed | `browsentic agent` — it reports *needs setup* again || Codex fails with "not logged in" | The daemon inherits no session | `codex login`, then retry || Codex answers about the page without opening it, or from a web search | Codex defers an MCP server's tools until the model searches for them, so a web search is the tool it can see; an older Browsentic also failed to switch that search off | Update Browsentic; the run now says where its browser tools are and switches web search off |-| Codex sees only part of a long page | Codex cuts any tool result over about 10,000 tokens | Ask for less at a time: a smaller `maxPerKind`, or `page_extractText` group by group |-| Mistral Vibe: every action on a follow-up turn fails with `RUN_INACTIVE` | Vibe re-reads a resumed session from the folder it began in, and an older Browsentic wrote each turn to a folder of its own | Update Browsentic — a conversation now keeps one folder, rewritten each turn |+| Codex sees only part of a long page | Codex cuts a tool result over 25,000 tokens; an older Browsentic left its 10,000 default in place | Update Browsentic, then ask for less at a time: a smaller `maxPerKind`, or `page_extractText` group by group |+| Mistral Vibe: every action on a follow-up turn fails with `RUN_INACTIVE` | Vibe re-reads a resumed session from the folder it began in, and an older Browsentic wrote each turn to a folder of its own | Update Browsentic, then start a new conversation: one begun before the update keeps its first folder || Grok Build sits silent for minutes, then fails with *xAI did not answer* | The Grok account is rate-limited, as a free one is; Grok retries quietly before giving up | Wait, or upgrade the account || `AGENT_UNSAFE`: *Grok Build offered this run …* | Grok offered tools Browsentic never asks for, so the run was stopped before the model saw them | Update Grok Build and Browsentic; report it if it persists |diff --git a/docs/internals/agent-runs.md b/docs/internals/agent-runs.mdindex 826c090..9c70f15 100644--- a/docs/internals/agent-runs.md+++ b/docs/internals/agent-runs.md@@ -100,8 +100,11 @@ Grok reaches MCP tools only through two meta-tools, `search_tool` and `use_tool``tools.mcp__browsentic__*`, where an image reaches the model only if the script passes it to`image()`. Left unsaid, a model answers from what it can see — its memory, or the web search Codexswitches on by default, which is why a run now passes `web_search="disabled"` unless it is mapping.-Codex also truncates any tool result over about 10,000 tokens, a limit its model catalog sets and no-flag raises, so its prompt asks for page reads in pieces.+Codex also cuts any tool result at 10,000 tokens by default, which its model catalog sets.+`tool_output_token_limit=25000` raises that to the ceiling Claude Code puts on an MCP result. Inside+`exec` the result is still cut at 10,000 unless the script's first line is+`// @exec: {"max_output_tokens": 25000}`, and only the prompt can ask for that, so it does. It also+asks for page reads in pieces.**A CLI that re-reads its own folder gets one per conversation, not one per run.** Vibe restores aresumed session from the folder it began in, whatever folder it is started in now, so a folder perdiff --git a/src/daemon/agent/runners/codex.test.ts b/src/daemon/agent/runners/codex.test.tsindex 7c146a0..76a2839 100644--- a/src/daemon/agent/runners/codex.test.ts+++ b/src/daemon/agent/runners/codex.test.ts@@ -57,6 +57,8 @@ describe('a streamed run', () => {"developer_instructions=<prompt>","-c","web_search="disabled"",+ "-c",+ "tool_output_token_limit=25000","--","what does this page cost",],@@ -112,6 +114,12 @@ describe('a streamed run', () => {expect(instructions).toMatch(/never answer from memory/i);});+ test('a tool result reaches the model whole up to the size a Claude run gets, and a code-mode script is told how to ask for it', () => {+ const args = stream().args;+ expect(args).toContain('tool_output_token_limit=25000');+ expect(instructionsIn(args)).toContain('// @exec: {"max_output_tokens": 25000}');+ });+// A mapping run is asked to research the domain, so its prompt cannot also forbid the search.test('a research run may search the web for background, and any other run is told not to', () => {expect([stream({ research: true }).args, stream().args].map((args) => instructionsIn(args).includes('from a web search'))).toEqual([false, true]);diff --git a/src/daemon/agent/runners/codex.ts b/src/daemon/agent/runners/codex.tsindex 00a07ef..66b622e 100644--- a/src/daemon/agent/runners/codex.ts+++ b/src/daemon/agent/runners/codex.ts@@ -39,11 +39,17 @@ const WEB_TOOL = 'web_search';*/const searching = (research: boolean): string[] => ['-c', `web_search=${tomlString(research ? 'live' : 'disabled')}`];+/**+ * Codex cuts a tool result at 10,000 tokens, which a dense page snapshot passes. This raises it to+ * the 25,000 Claude Code allows an MCP result. A code-mode model's `exec` keeps its own 10,000+ * unless the script's first line asks for more, which only the prompt can tell it to do.+ */+const RESULT_TOKENS = 25_000;+/*** Codex keeps an MCP server's tools out of the model's tool list: they are deferred behind* `tool_search`, and a code-mode model reaches them only from inside `exec`. A run that does not- * say so watches the model answer from memory or a web search, because those it can see. Codex- * also cuts a tool result at about 10,000 tokens, which a whole-page snapshot passes.+ * say so watches the model answer from memory or a web search, because those it can see.*/const reachingTheBrowser = (research: boolean) => `# Reaching the browser from Codex@@ -51,7 +57,7 @@ Your browsentic tools are not in your tool list yet, because Codex defers them.The page the user means is the one open in their browser. Read it with these tools. Never answer from memory${research ? '' : ', from a web search,'} or by fetching the page from the shell${research ? ', and keep a web search to background the page cannot give you' : ''}.-Codex truncates a tool result over roughly 10,000 tokens, so ask for less at a time — \`page_getPageInfo\` with a small \`maxPerKind\`, \`page_extractText\` with the cursor it hands back — rather than one large read whose middle goes missing.`;+When you reach the tools through \`exec\`, start every script that reads the page with the line \`// @exec: {"max_output_tokens": ${RESULT_TOKENS}}\`, or its output is cut at 10,000 tokens. Even then a tool result over ${RESULT_TOKENS} tokens comes back cut, so ask for less at a time — \`page_getPageInfo\` with a small \`maxPerKind\`, \`page_extractText\` with the cursor it hands back — rather than one large read whose middle goes missing.`;interface Item {id?: string;@@ -128,6 +134,8 @@ export const codexRunner: Runner = {'-c',`developer_instructions=${tomlString(`${context.systemPrompt.trim()}\n\n${reachingTheBrowser(research)}`)}`,...searching(research),+ '-c',+ `tool_output_token_limit=${RESULT_TOKENS}`,...(settings.model ? ['--model', settings.model] : []),...(effort ? ['-c', `model_reasoning_effort=${tomlString(effort)}`] : []),'--',