# What is Chalk?
source: https://docs.chalk.ai/docs/what-is-chalk

## Chalk is the platform for production AI: context, runtime, and learning for your agents and models.

Chalk gives you the infrastructure to build, run, and improve production AI in your own cloud:

- Context: serve fresh, real-time data to your agents and models at inference time, in milliseconds
- Runtime: deploy and run those agents and models securely and at scale
- Learning: train models on point-in-time correct history, and evaluate agents and models before you ship them

Chalk delivers these through the Context Engine and Chalk's runtime, both built on the same philosophy: define what you need in Python, and run it on infrastructure you control.

### Why teams use Chalk

Most teams assemble a production AI stack from a feature store, a vector database, retrieval and prompt tooling, an orchestration layer, a sandbox runtime, and a governance story, then fight to keep them all consistent. Chalk replaces that stack with a single platform. Teams use it to:

- Power AI agents with business context: give agents current customer, transaction, or operational data from your existing systems, served in single-digit milliseconds
- Build real-time machine learning applications: define features, embeddings, and prompts once in Python, train models on point-in-time correct data, and serve the same values in production
- Run agents and models: deploy functions, model servers, and isolated sandboxes
- Evaluate AI behavior: test agents against defined examples, score outputs, and inspect traces to understand failures and compare changes
- Keep the platform in your own cloud: run Chalk in your VPC under IAM roles you control with a self-hosted deployment, so your security team evaluates the platform once instead of every agent you ship

Context, Runtime, and Learning run in the same Chalk environment, so they can use each other directly: an agent can request features, and a feature can call a deployed model. Core Concepts shows how the three areas fit together.

### The Context Engine

The Context Engine is a real-time feature computation engine that serves as the single source of truth for your features. You define features once in Python, and Chalk computes and serves them directly from your data sources at inference time in milliseconds.

Unlike traditional feature stores, which behave like databases or caching layers, Chalk keeps training and serving perfectly in sync and makes feature development faster. It adds built-in monitoring, a branch-based deployment model for feature versioning, and deployment inside your own cloud.  This is especially critical for teams working with sensitive data or in regulated industries.

Here's a quick example of declarative feature engineering in Chalk:

```
from chalk.features import features
from chalk import online

@features
class User:
    id: int
    total_orders: int
    chargeback_rate: float
    fraud_score: float

@online
def score_fraud(
    orders: User.total_orders, cbr: User.chargeback_rate,
) -> User.fraud_score:
    return 0.7 * cbr + 0.3 * (orders < 3)
```

You can query features in real time, or as of any point in the past for training and evaluation. For example, a larger fraud pipeline can expose a fraud prediction alongside transaction features:

The interactive example shows a recorded fraud query plan. Select an operator to inspect it, or use the zoom controls to explore the graph.

### Runtime

Chalk's runtime runs your agents, models, and code. Each workload takes one of three shapes:

- Sandboxes: isolated environments for ephemeral tasks, such as running code an agent generated
- Functions: Python callables you deploy and call remotely, which resolvers and Chalk SQL queries can also call
- Scaling groups: long-running HTTP services that autoscale, such as a model server or an agent backend

Your agents reach hosted LLMs through the Model Gateway, and your MCP servers and SaaS tools through the MCP Gateway.

Here's a simple example of spinning up a sandbox:

```
import chalkcompute

sandbox = chalkcompute.Sandbox(
    image=chalkcompute.Image.debian_slim("3.13").pip_install(["anthropic"]),
    cpu="2",
    memory="4Gi",
).run()

print(sandbox.exec("echo", "hello!").stdout_text)
sandbox.terminate()
```

Each sandbox runs under gVisor, with its own filesystem, network namespace, and resource limits. A sandbox created with chalk_identity=True gets its own workload identity, so no two sandboxes share credentials. The same SDK runs persistent services on scaling groups, for example a GPU-backed model server:

```
import chalkcompute

server = chalkcompute.ScalingGroup(
    image=chalkcompute.Image.base("vllm/vllm-openai:latest"),
    gpu="nvidia-l4:1", cpu="4", memory="16Gi", port=8000,
    min_replicas=0, max_replicas=1,
    entrypoint=["--model", "Qwen/Qwen2.5-7B-Instruct"],
).deploy()
```

### Learning

Learning covers training models and testing changes to agents and models before you ship them.

A training function reads a dataset produced by an offline query, so the model trains on the feature values each row would have seen in production at that row's point in time. You register the trained model in the model registry and serve it on its own scaling group, where a feature can call it.

An evaluation runs a task, usually a deployed function such as an agent or a prompt, against a fixed dataset of examples, and scorers grade each output. Each run records a trace of the task for every row, so you can inspect each step and compare runs of a new version against the same examples.

### Get started

- Install the CLI and create a project. Install the Chalk CLI, then run chalk login and chalk init. chalk init installs chalkpy for the Context Engine and chalkcompute to run agents and models. The Setup Guide walks through each step.
- Choose where Chalk runs. Point Chalk at your cloud account so it runs in your VPC, or use Chalk Serverless. Sandboxes, functions, and scaling groups run on AWS or GCP; the Context Engine also supports Azure.
- Define your features. Write resolvers for the data your models and agents need, then chalk apply to deploy them.
- Query them in real time, or backfill any feature as of any point in the past.
- Run your agents. Decorate a Python function with @chalkcompute.function and invoke it remotely.

Next steps: read the docs overview, Core Concepts, the feature engineering guide, and the API reference.





