xAI just open-sourced Grok's coding agent (in Rust)

4 months ago

xAI just open-sourced the real source code for Grok's coding agent. The actual Rust harness, not a wrapper. It's called Grok Build, and it runs three ways, off any model you point it at. That last part is the whole story.

Ask about this presentation

Chapters

  1. 0:00xAI just open-sourced Grok's coding agent (in Rust)
  2. 0:12A full agent that lives in your terminal
  3. 0:28The real source, not a docs stub
  4. 0:46One runtime. Three front doors.
  5. 1:04It'll drive any model you want
  6. 1:21Its tools are ported from other agents
  7. 1:45One line gets it
  8. 2:06Read the real agent · run it three ways · point it at any model.
Show transcript
  1. xAI just open-sourced the real source code for Grok's coding agent. The actual Rust harness, not a wrapper. It's called Grok Build, and it runs three ways, off any model you point it at. That last part is the whole story.

    Slide text
    GitHub Trending · Ep 11 · Jul 17, 2026
    Runs three ways: TUI, headless, or in your editor.
    Grok Build Rust Apache-2.0 TUI · headless · editor
    coming up: point it at any model you want
  2. Here's grok running in your terminal. From one prompt line it reads your whole codebase, edits files, runs shell commands, and searches the web. Up top, it's streaming an answer back live and tracking its own context as it works. This isn't a chat box wired to your editor. It's a full agent that lives in the terminal.

    Slide text
    From one prompt line, it:
    reads your codebase edits files runs shell commands searches the web
    Streaming its answer back live, tracking its own context as it works.
    shown in the TUI
    xai-org/grok-build — README
  3. Coding agents are everywhere this year, and almost all of them are closed. What xAI shipped is different: the real, layered Rust source, synced straight from their internal monorepo. There's even a pinned commit file recording exactly which internal build this tree was cut from. So you can read how a production coding agent is actually put together.

    Slide text
    xai-grok-pager-bin composition root · builds the grok binary
    xai-grok-pager the TUI · scrollback, prompt, rendering
    xai-grok-shell agent runtime · leader / stdio / headless
    xai-grok-tools tool implementations
    xai-grok-workspace files · VCS · exec · checkpoints
    SOURCE_REV pins the exact internal commit this tree was cut from
    README — Repository layout · SOURCE_REV
  4. And here's the clever part. It's one agent runtime with three front doors. Run it as a fullscreen terminal app you click around in. Run it headless for scripts and CI. Or wire it into your editor over the Agent Client Protocol, and the same agent drives from inside. Same engine underneath. You just choose how it shows up.

    Slide text
    Fullscreen TUI
    grok
    →
    Headless for scripts & CI
    grok -p
    →
    Editor, over ACP
    grok agent stdio
    →
    xai-grok-shell
    one agent runtime
    ACP = Agent Client Protocol
    Same engine underneath. You choose how it shows up.
  5. By default it runs on grok four point five, xAI's own model. But add a few lines to a config file, and it'll drive any OpenAI-compatible model instead. Point it at your own endpoint, start it with grok dash m and the model name, and you're off. It's a harness, not a lock-in.

    Slide text
    grok-4.5 by default
    ~/.grok/config.toml
    [model.my-model]
    model    = "provider/model-id"
    base_url = "https://api.example.com/v1"
    env_key  = "MY_API_KEY"
    grok -m my-model
    docs.x.ai/build — Custom models
  6. Now the part I didn't expect. Open the tools folder, and some of the implementations are ported straight from other agents. The file search and read handlers come from OpenAI's Codex, under Apache. Bash, edit, glob, and grep come from sst's opencode, under MIT. A frontier lab shipped its coding agent with tool code openly borrowed from a rival's and from an independent open project. The whole field is converging on shared tools.

    Slide text
    openai/codex Apache-2.0
    file search & read handlers, ported in-tree
    apply_patch grep_files list_dir read_file
    sst/opencode MIT
    shell & editing tools, ported in-tree
    bash edit glob grep read skill todowrite write
    The field is converging on shared, open tool code
    xai-grok-tools — THIRD_PARTY_NOTICES
  7. Getting it is one line: curl the install script into bash, on Mac, Linux, or WSL. Then cd into a project and just run grok. The current build is v0.2.101, still labeled Beta. One honest note: this is a read-only mirror of xAI's internal tree. You can read it, build it, fork it, but they don't take outside patches. It's the source, not a community project.

    Slide text
    curl -fsSL https://x.ai/cli/install.sh | bash
    cd project && grok
    macOS · Linux · WSL Apache-2.0 v0.2.101 (Beta)
    A read-only mirror of xAI's internal tree.
    Read it, build it, fork it — but no outside contributions. The source, not a community project.
    README — Install · x.ai/build changelog · GitHub API, Jul 17 2026
  8. So if you've ever wanted to see how a production coding agent is really built, or run one against your own model, this is the source to read. Apache two, Rust, all of it in the open. The link's on screen. New repo tomorrow.

    Slide text
    GitHub Trending
    Apache-2.0 Rust in the open
    github.com/xai-org/grok-build
    New repo tomorrow.

What happened in AI today, in your inbox

One short email each evening. Read it and you’re caught up.

Built with ❤️ in New York