
xAI shipped Grok 4.7 this week, and the pitch aims at one thing: agents that work for hours without you. Multi-hour autonomous coding sessions, self-directed task decomposition, the whole long-horizon story. GitHub Copilot added it to the model picker within days, so a lot of developers are about to point a Grok 4.7 long-horizon agent at a real repository and walk away. Early hands-on testing says that is a mistake. The model is genuinely strong in short bursts and still fails the majority of genuinely long-running tasks, and the shapes of those failures are more useful than any benchmark number.
What’s new in the Grok 4.7 long-horizon agent
The headline change in the xAI Grok 4.7 release is not raw reasoning quality. It is context persistence and tool-loop stamina. Grok 4.7 is tuned to keep a task plan alive across hundreds of tool calls, re-read its own prior work, and recover from failed steps without a human nudging it back on track. xAI frames this as the jump from “assistant that answers” to “worker that finishes.” The model card emphasizes sustained agentic sessions measured in hours, not the single-turn benchmarks that dominated earlier 4.x launches.
Three things changed. First, the context window and the model’s attention to the middle of it both improved, which is what kills most long agent runs: the agent forgets the constraint you gave it on turn four by turn ninety. Second, tool-call formatting holds up better under pressure, with fewer malformed JSON payloads at high call counts. Third, xAI tightened the reasoning-effort controls, so you can spend tokens where they matter instead of burning them on trivial file reads. Grok 4.7 API pricing follows the now-standard tiered structure, with reasoning tokens billed as output. That matters enormously when your agent runs for three hours.
The Grok 4.7 GitHub Copilot integration arrived fast, and that speed is the real distribution story. Copilot’s agent mode is where most developers will meet this model, not the raw API. That also means most people will evaluate it inside a harness xAI did not build, with a system prompt xAI did not write, on repositories that look nothing like the eval set. Expect a gap between the launch-day demos and your Tuesday afternoon.
Why it matters
- The failure mode moved, it did not disappear. Older models failed fast and obviously. Grok 4.7 fails slowly and plausibly, producing two hours of confident, coherent, wrong work. That is harder to catch and more expensive to clean up.
- Copilot distribution changes the risk surface. A model in the Copilot picker gets pointed at production repos by people who did not read the model card. The Grok 4.7 agent failure rate you see in a sandbox is not the one you get against a legacy monolith with a flaky test suite.
- Long-horizon billing is a different cost curve. A three-hour agent run with reasoning tokens billed as output can cost more than a week of interactive chat. Budget per task, not per seat.
- Verification is the bottleneck now, not generation. If an agent can write four hours of code, your CI, your test coverage, and your review process become the constraint. Most teams’ pipelines are not built for that throughput.
- Benchmarks lag the claim. No widely accepted public benchmark answers “did the agent finish a real multi-hour task correctly.” Until one exists, every long-horizon claim from every vendor is marketing until you reproduce it.
- It raises the floor for scaffolding. Checkpoints, task files, and forced re-grounding are no longer optional hygiene. They are the difference between a usable agent and a very expensive random number generator.
How to use the Grok 4.7 long-horizon agent today
-
Get API access and confirm the model ID. Do not hardcode a guessed string. List what your key can actually reach.
curl https://api.x.ai/v1/models \ -H "Authorization: Bearer $XAI_API_KEY" -
Run a baseline single-turn call before you trust it with anything long. Verify latency and token accounting on a task you already know the answer to.
curl https://api.x.ai/v1/chat/completions \ -H "Authorization: Bearer $XAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "grok-4.7", "messages": [ {"role": "user", "content": "Summarize the failure modes of long-running coding agents in 5 bullets."} ], "stream": false }'Check the
usageobject in the response. Reasoning tokens are where your money goes on long runs. Know the number before you scale it by a thousand. -
Enable it in GitHub Copilot. In VS Code, open the Copilot Chat model picker and select Grok 4.7 for agent mode. To pin it per-workspace:
// .vscode/settings.json { "github.copilot.chat.agent.enabled": true, "github.copilot.chat.defaultModel": "grok-4.7", "github.copilot.chat.agent.maxRequests": 50 }That request cap is a feature. Uncapped agent loops are how a “quick refactor” becomes a 400-file diff.
-
Force an external task file. This is the single highest-leverage fix. The model’s internal plan degrades over long runs. A file on disk does not. Put this at the top of your agent prompt:
Before doing anything, write TASK.md containing: - GOAL: one sentence, the definition of done - CONSTRAINTS: things you must not change - STEPS: numbered, each independently verifiable - STATUS: update after every step (done / failed / skipped + why) After EVERY tool call, re-read TASK.md. If your next action is not in STEPS, stop and ask. Never mark a step done without running its verification command. -
Give it a verification command it cannot fake. Agents mark work complete because it looks complete. Make “done” mean an exit code.
VERIFY = "npm run lint && npm test -- --run && npm run build" # Agent rule: a step is only 'done' when VERIFY exits 0. # Paste the full failing output back into context. Do not summarize it. -
Checkpoint with git, every step, automatically. Long runs need rollback points, not a single catastrophic diff at the end.
git checkout -b agent/grok-4.7-run-$(date +%s) # after each completed step: git add -A && git commit -m "agent: step N - <what changed>"When the run goes sideways at step 14, you lose one step, not four hours.
-
Cap the horizon deliberately. Run 45–60 minutes, stop, review the diff yourself, then restart with a fresh context and an updated TASK.md. Testing consistently shows quality degrading well before the marketing-claimed ceiling. Two supervised hour-long runs beat one unsupervised four-hour run, every time.
How it compares: Grok 4.7 vs Claude Code and the field
| Dimension | Grok 4.7 | Claude Code (Opus/Sonnet) | GPT-class agents | Gemini agents |
|---|---|---|---|---|
| Pitch | Multi-hour autonomous work | Supervised long sessions, strong tool discipline | General agentic breadth | Long context, cheap high-volume runs |
| Short-task quality | Strong | Strong | Strong | Good |
| Observed long-run reliability | Weakest link; degrades before the claimed ceiling | Most consistent with explicit checkpoints | Mixed, harness-dependent | Holds context, weaker tool recovery |
| Typical failure | Confident drift from the original goal | Over-cautious stalling, asks to confirm | Tool-loop thrash | Shallow verification |
| Copilot availability | Yes, day-one | Yes | Yes | Yes |
| Cost profile on long runs | Reasoning tokens dominate | Predictable, caching helps | Varies by tier | Generally cheapest |
| Best fit | Bounded, well-specified refactors | Multi-file work with review gates | Broad tool integration | Large-corpus analysis |
The honest summary of Grok 4.7 vs Claude Code: on a forty-minute, clearly scoped task, they are close enough that your harness and prompt matter more than the model. Past the ninety-minute mark, the difference is not intelligence. It is whether the model keeps checking its own work against the original goal. That is where Grok 4.7 loses, and it loses quietly.
What’s next
Watch for a real long-horizon benchmark. The industry has excellent single-turn evals and almost nothing credible for “the agent worked for three hours and the result was correct.” Whoever ships a reproducible, contamination-resistant version of that eval sets the terms of the next year of agent marketing. Until then, treat every multi-hour claim, from xAI or anyone else, as a hypothesis you test on your own repo with your own test suite.
Expect fast iteration from xAI. The 4.x line ships point releases aggressively, and the failure modes surfacing now — goal drift, premature completion, unverified “done” claims — are exactly what gets patched in a 4.8 with better self-critique loops. Watch the harness layer too: much of what people attribute to model quality is really Copilot’s or Cursor’s scaffolding. Improvements there will lift Grok 4.7’s apparent reliability without xAI touching the weights.
The strategic question for long-horizon AI agents in 2026 is whether the bottleneck stays with the model or moves to verification. If models keep getting better at generating hours of work, teams without fast, trustworthy test suites cannot use them safely — the review cost eats the gain. The winning setup this year is not the most autonomous agent. It is the tightest loop between an agent that writes and a pipeline that proves.
Frequently Asked Questions
Can Grok 4.7 actually run for multiple hours?
It can stay in a tool loop for hours, yes. Whether the output is correct at the end is a separate question, and in hands-on testing it frequently is not. The model keeps working; it just stops working on the thing you asked for. Cap runs at 45–60 minutes and review between segments.
What is the real Grok 4.7 agent failure rate?
No trustworthy public number exists, because no agreed benchmark measures multi-hour task completion. Early independent testing reports failure on the majority of genuinely long-running tasks. Measure it yourself: run ten representative tasks from your own backlog and count how many pass CI without human edits. That number is the only one that matters for your team.
Should I use Grok 4.7 in GitHub Copilot right now?
For bounded work — a single-file refactor, a test suite for an existing module, a migration with a clear spec — yes, it is competitive. For “go fix the auth system,” no. Set maxRequests, work on a branch, and read the diff before you merge.
How does Grok 4.7 API pricing affect long agent runs?
Reasoning tokens bill as output, so cost scales with how much the model thinks, not just what it writes. A long agentic run can cost 10–50x an interactive session on the same task. Log the usage object from every call, set a hard spend alert, and price your first few runs before you automate anything.
Grok 4.7 vs Claude Code — which should I pick for agentic coding?
If your work is short and well-specified, either. If you need multi-file changes with review gates and consistent tool discipline over long sessions, Claude Code is the safer default. The practical answer is to run both on the same three tasks from your repo this week; the comparison takes an afternoon and beats any blog post, including this one.
What single change most improves long-horizon agent reliability?
An external task file the agent must re-read after every tool call, paired with a verification command that returns an exit code. Internal plans drift; files on disk do not. That one pattern fixes more long-run failures than any model upgrade shipped this year.
Go deeper than this article
This article covers the essentials. Our premium eguide library gives you the full step-by-step playbooks — prompts, workflows, and copy-paste recipes you can put to work today.