Ana içeriğe atla

Grok Build Tutorial: Build a Machine Learning Project

Learn how to set up Grok Build, configure cross-session memory, safety settings, and project instructions, and use SpaceXAI’s coding agent to build an end-to-end machine learning project.
23 Tem 2026  · 9 dk. oku

Yapay Zekâyla Keşfet

ChatGPT'de açClaude'da açPerplexity'de aç

Grok 4.5 is the latest AI model powering Grok Build, designed for coding, agentic tasks, and complex knowledge work. Grok Build brings these capabilities directly to your terminal, where it can plan projects, create and edit files, install packages, run commands, test code, and fix errors with your approval.

Grok 4.5 Official Benchmark

Source: Introducing Grok 4.5 

In this guide, I will explore Grok Build, demonstrate its key features, and configure its cross-session memory, project instructions, reusable skills, and safety settings. 

We will then use it to build a complete end-to-end machine learning project, from setting up the environment and analyzing the data to training models, evaluating the results, and creating a prediction application.

What is Grok Build?

Grok Build is SpaceXAI’s coding agent that runs directly inside your terminal. 

It belongs to the same category of tools as Claude Code and OpenCode: you describe what you want to build in normal language, and the agent works with the files and tools on your computer to complete the task. 

It can explore an existing project, create and edit files, install packages, run commands, test the code, identify errors, and fix problems.

Grok Build is also surprisingly user-friendly. You do not need to provide detailed coding instructions for every step, and it can reuse configurations from other coding agents, including agent skills, MCP configurations, and project settings. 

These featues makes the installation and setup process feel much smoother, especially if you are already using similar tools.

The main downside is the usage limit. 

Although Grok Build is available on the free plan, the free allowance can run out quickly when working on a complete project. 

The full SuperGrok plan costs $30 per month, which feels expensive compared with some competing tools. Claude Pro, for example, costs $20 per month and includes access to Claude Code.

Despite the pricing, Grok Build is a capable and approachable coding agent, especially for users who want an AI assistant that can do more than simply generate small code snippets.

Grok Build Key Features

Grok Build includes standard coding-agent features such as Plan Mode and project instructions through an AGENTS.md file. 

However, its memory, media generation, background automation, agent management, and extension system make it more useful for larger projects.

1. Cross-session memory

Grok can remember useful information across different sessions, including project commands, technical decisions, folder structures, and coding rules. 

This means you do not have to explain the same project every time you return.

2. Subagents

Grok can create independent child agents with their own context. 

For example, one agent could explore the codebase while another creates a plan, writes tests, or works on a separate feature.

3. Session fork and rewind

You can fork a session to test a different approach without losing your original conversation. 

Rewind also lets you return to an earlier stage when something goes wrong.

4. Git worktrees

Git worktrees allow Grok to work inside an isolated copy of the repository. 

This protects the main project while you test experimental features or run multiple agents at the same time.

5. Image and video generation

You can generate images and videos directly inside Grok Build using the /imagine and /imagine-video commands. 

This can be useful when building applications that need visual assets, mockups, or demo content.

6. Run loop

The /loop command lets Grok repeat a prompt at a selected interval. For example, you could ask it to check your tests, monitor a deployment, or report new errors every few minutes.

7. Vim mode

Grok Build includes a Vim Mode for users who prefer Vim-style keyboard controls while navigating the terminal interface. You can enable or disable it using /vim-mode.

8. Personas

Personas let you give agents different behavioral styles, areas of focus, or working rules. 

You can manage them using /personas and apply them to different subagents.

9. Agent dashboard

The Agent Dashboard provides a live overview of all your sessions. 

You can see which agents are working, waiting for input, completed, or failed, and open any session directly from the dashboard.

10. Hooks

Hooks let Grok automatically run commands or call an HTTP endpoint before or after specific events. 

You could use them to block dangerous commands, format code after edits, record tool usage, or send a notification when a task finishes.

11. Plugins

Plugins extend Grok Build with additional agents, hooks, MCP servers, language servers, and other functionality. Existing Claude Code plugins can also be discovered automatically without requiring a completely new setup.

12. Plugin marketplace

The built-in Marketplace allows you to browse and install plugins from configured sources directly inside Grok Build. You can open it using the /marketplace command.

How to Set Up Grok Build

Before building the machine learning project, we need to install Grok Build, connect our SpaceXAI account, and open it inside a dedicated project folder.

1. Install Grok Build

Open your terminal and run the command for your operating system.

For macOS, Linux, or WSL:

curl -fsSL https://x.ai/cli/install.sh | bash

For Windows PowerShell:

irm https://x.ai/cli/install.ps1 | iex

The installer downloads Grok Build and adds the grok command to your system.

2. Sign in to your SpaceXAI account

Next, sign in by running:

grok login

Login to the Grok Build

Grok Build will open a browser window where you can sign in to your SpaceXAI account and approve access. 

You normally only need to complete this process once.

3. Create the project folder

Create a separate folder for the machine learning project and move into it:

mkdir machine-learning-project
cd machine-learning-project

Now launch Grok Build inside the folder:

grok

Grok build TUI

Configure Grok Build for the Project

Before building anything, we will configure Grok Build to remember important project information, follow safer permission rules, and apply the same development instructions in every session.

1. Enable cross-session memory

Cross-session memory allows Grok to remember useful information after you close the terminal and return to the project later.

Start Grok Build with memory enabled:

grok --experimental-memory

Inside Grok Build, you can save an important note manually:

/remember This project uses uv for package management and pytest for testing.

Grok Build persistent memory feature.

You can also use /memory to view and manage saved information. 

Use memory for stable details such as important commands, technology choices, folder structures, and coding conventions. 

Temporary instructions should remain inside the current session. 

2. Add safe permission rules

Grok Build uses Ask mode by default, which means it requests approval before running tools that have not already been allowed.

We will add project-level permission rules to make normal development smoother while explicitly blocking risky actions. 

Ask Grok to prepare the configuration:

Create a safe .grok/config.toml configuration for this project. 
Allow normal file editing, Git inspection, testing, and linting, 
but deny access to secret files, destructive shell commands, Git pushes, 
force pushes, and changes outside the project folder.

Setting Grok Build permissions

3. Create permanent project instructions

Next, create an AGENTS.md file containing the rules Grok should follow throughout the project. 

Grok automatically loads this file whenever it works inside the repository, so you do not need to repeat the same instructions in every session. 

Use the following prompt:

Create a short AGENTS.md file for an end-to-end machine learning project. 
Protect the raw data, prevent data leakage, use reusable Python modules, 
manage packages with uv, add tests, commit every major change, and validate 
each stage before continuing.

Creating the Permanent Project Instructions in Grok Build

Keep the instructions short and specific, as Grok is more likely to follow focused project rules consistently. 

4. Verify the configuration

Finally, check that Grok has discovered the project rules, settings, skills, plugins, and MCP servers:

grok inspect

Inspecting Grok Build configurations

Once everything appears correctly, we can begin building the machine learning project.

Grok Build Demo: Build an End-to-End Machine Learning Project

Now that Grok Build is installed and configured, we can use it to create the complete machine learning project from scratch.

1. Create the project plan

Start by switching to Plan Mode, so Grok can inspect the task and explain how it intends to build the project before changing any files:

/plan

Then, enter the following prompt:

Build an end-to-end machine learning project from scratch. 
Check whether Git and uv are installed, initialize the repository, 
create a uv environment, install the required packages, organize the project, 
download a toy dataset, analyze and clean the data, create visualizations, 
train and compare models, evaluate the best model, build a simple prediction 
CLI application, add tests, and document the results.

plan model with initial instruction in the Grok Build

2. Review and approve the plan

Once the plan is ready, read through it carefully. You can ask Grok to add missing steps, remove unnecessary work, or change the tools and libraries it plans to use.

Plan mode so that you can accept it or make a change in the Grok Build

When everything looks correct, approve the plan. Grok will then start creating the project, installing packages, writing code, running tests, and showing you the changes it makes.

3. Continue after reaching the usage limit

While building the project, we reached the free usage limit. 

Large coding tasks consume more usage than normal chat requests, so this can happen quickly when Grok is analyzing data, training models, fixing errors, and running tests.

Hitting the free usage limit and subscribing to Super Grok Subscription in the Grok Build

SuperGrok currently costs $30 per month and provides higher usage limits across Grok’s features. 

It is not cheap, but the additional allowance can be useful when you are building a complete project rather than testing a few small prompts.

After upgrading, return to the same session, type:

continue

Continuing the stop process in the Grok Build

Grok will pick up from where it stopped and continue building the project.

4. Review the final project summary

Once the work is complete, Grok provides a summary explaining what it created. This includes the data analysis, visualizations, model-comparison results, evaluation metrics, tests, project structure, and instructions for running the prediction application.

Model was trained and evaluated and we got 98% accuracy. All done by Grok Build

In our project, Grok trained a logistic regression model on the Palmer Penguins dataset. 

The best model achieved approximately 98% accuracy and an F1 score of 97.6%, which is an excellent result for this small classification project.

5. Explore the generated files

You can open the project folder in VS Code and explore the generated files one by one. 

This is useful for understanding how Grok organized the source code, data-processing pipeline, tests, reports, and command-line application.

Here is the overview of all the project files, folders, and configuration for you to review in VS Code

Even though Grok created the project for us, it is still important to review the code and understand how each part works.

6. Test the prediction application

Open another terminal inside the project folder and run the following command:

uv run penguins predict \
  --bill-length 39.1 \
  --bill-depth 18.7 \
  --flipper 181 \
  --body-mass 3750 \
  --sex male \
  --island Torgersen

The Machine Learning CLI predict works and we got an accurate result

The CLI app processes the values using the same preprocessing pipeline and trained model used during evaluation. In our test, it returned the expected penguin species, confirming that the prediction application worked correctly.

Final Thoughts

Overall, I think Grok Build is a very good and surprisingly refined coding agent. 

You can use it through your SuperGrok subscription or connect it directly to the SpaceXAI API using an API key. 

More importantly, you are not limited to Grok models. 

Grok Build supports custom models through OpenAI-compatible and Anthropic-compatible APIs, which means you can also connect an open-source model running locally or use another API provider. 

You can follow the official custom model configuration guide to set this up. 

It also works smoothly with plugins, marketplaces, reusable skills, agents, hooks, and MCP servers. 

Grok can automatically discover existing Claude Code skills, plugins, MCP configurations, and instruction files without requiring you to set everything up again. 

The overall experience is very user-friendly. 

Updates are checked automatically when Grok Build starts, while the grok update command lets you manually install the latest version. 

Everything from installation and configuration to switching models and adding tools feels simple and well-designed. 

Compared with OpenCode, Grok Build currently feels like the more polished and mature product to me. 

It is already close to Claude Code in terms of features and the overall coding experience, and I expect it to continue improving. 

My main concern is still the cost and limited free usage, but apart from the subscription, I have high hopes for Grok Build.

Grok Build FAQs

Is Grok Build open source?

Yes. While the AI models themselves (like Grok 4.5) are hosted and accessed via API, the actual Grok Build terminal client, including the agent loop, workspace management, and tool dispatch, is fully open-source. It is a massive Rust codebase licensed under Apache 2.0, meaning you can audit how it handles your files, compile it directly from source, or fork it to build custom internal harnesses.

How does Grok Build handle data privacy and security?

This is a critical area following an incident in mid-July 2026. Security researchers discovered that earlier versions of the Grok CLI were bundling and uploading entire Git repositories (including commit histories and ignored .env files) to xAI's cloud storage, regardless of which files the agent actually needed to read.

In response to the backlash, SpaceXAI disabled the codebase upload feature server-side, deleted all previously retained user data, and shifted Grok Build to a default zero-data-retention policy. Because the CLI is now open-source, developers can verify these privacy changes directly or run the harness completely air-gapped by pointing it to local model endpoints.

Can I run Grok Build in scripts or CI/CD pipelines?

Yes. Although Grok Build is known for its interactive, full-screen Terminal UI (TUI), it also includes a Headless Mode designed for automation. By passing the -p flag alongside your prompt (and optionally specifying an output format like --output-format streaming-json), you can run Grok Build entirely in the background. This makes it easy to integrate the agent into CI/CD workflows, automated code review bots, or deployment scripts.

What is the Agent Client Protocol (ACP)?

While this article focuses on the terminal experience, Grok Build can also function outside of it via the Agent Client Protocol (ACP). This protocol allows the Grok Build harness to run as a headless backend engine, allowing developers to embed its file-editing, tool-calling, and reasoning capabilities directly into other third-party applications, IDEs, or custom developer environments.


Abid Ali Awan's photo
Author
Abid Ali Awan
LinkedIn
Twitter

As a certified data scientist, I am passionate about leveraging cutting-edge technology to create innovative machine learning applications. With a strong background in speech recognition, data analysis and reporting, MLOps, conversational AI, and NLP, I have honed my skills in developing intelligent systems that can make a real impact. In addition to my technical expertise, I am also a skilled communicator with a talent for distilling complex concepts into clear and concise language. As a result, I have become a sought-after blogger on data science, sharing my insights and experiences with a growing community of fellow data professionals. Currently, I am focusing on content creation and editing, working with large language models to develop powerful and engaging content that can help businesses and individuals alike make the most of their data.

Konular

Top DataCamp Courses

Kurs

LangGraph ile Çoklu Aracılı Sistemler

2 sa 45 dk
7.1K
LangGraph çerçevesinde yeni ortaya çıkan ajan tasarım modellerini uygulayarak güçlü çoklu ajan sistemleri oluşturun.
Ayrıntıları GörRight Arrow
Kursa Başla
Devamını GörRight Arrow
İlgili

Eğitim

Grok 3 API: A Step-by-Step Guide With Examples

Learn how to use the Grok 3 API for tasks ranging from basic queries to advanced features like function calling and structured outputs.
Tom Farnschläder's photo

Tom Farnschläder

Eğitim

Grok 4 API: A Step-by-Step Guide With Examples

Learn how to use Grok 4’s API through practical examples featuring image recognition, reasoning, function calling, and structured output.
Tom Farnschläder's photo

Tom Farnschläder

Eğitim

Grok Voice Agent Builder: A Hands-On Guide in Python

Build a Python voice agent with the same API used by Grok Voice Agent Builder: WebSocket setup, audio streaming, tool calling, cost tracking, and a FastAPI endpoint.
Khalid Abdelaty's photo

Khalid Abdelaty

Eğitim

OpenAI o1-preview Tutorial: Building a Machine Learning Project

Learn how to use OpenAI o1 to build an end-to-end machine learning project from scratch using just one prompt.
Abid Ali Awan's photo

Abid Ali Awan

Eğitim

Seven Grok 4 Examples to Try in the Chat Interface

Learn how to make the most of Grok 4 through seven practical examples you can try in the chat interface.
Aashi Dutt's photo

Aashi Dutt

Eğitim

Grok Imagine API: A Complete Python Guide With Examples

Learn how to generate videos using the Grok Imagine API. This Python guide covers everything from image animations to video editing with the new xAI video model.
François Aubry's photo

François Aubry

Devamını GörDevamını Gör