AI Configs

Create and version configs in Statsig Agent Experimentation to manage the model, prompt messages, and parameters your app uses, and change them without deploying code.

A config stores the model, prompt messages, and parameters for one LLM task in your app, such as classifying a support ticket. Configs on this page are Agent Experimentation configs, not Dynamic Configs. Your app fetches the config at runtime with a Statsig AI SDK, so you can change the model or the prompt without deploying code. Each config has versions. Your app serves the Live version, and you evaluate other versions before you promote one to Live.

Use a config to serve, evaluate, and roll out a prompt in production. To compare prompts side by side before you commit to one, use the Playground instead.

The Statsig SDKs and the Console API still call configs "prompts." For example, the Node AI SDK fetches a config with getPrompt.

Find a config

Go to Agent Experimentation > AI Configs to open the list of configs in your project. The list has these columns:

Search the list by name, or sort it by Name or Last Modified. Filter it by Creator, Tag, or Target Application. The Target Application filter appears only when your project uses target applications.

Click a config to open it. The config page has three tabs: Setup, Runs, and Traces.

Create a config

  1. Go to Agent Experimentation > AI Configs and click Create. You can also click Create on the Statsig home page, then click AI Config.
  2. In the Create New Config dialog, enter a name. Statsig shows the config ID under the name, after ai_config_name:. The ID is the name in lowercase, with underscores in place of spaces. Your app uses the ID to fetch the config.
  3. (Optional) Enter a description.
  4. (Optional) Choose a Team, Tags, and Target Apps. By default, a new config uses your first team and that team's default target applications.
  5. Click Create.

Create New Config dialog with the name Support Bot, the config ID ai_config_name: support_bot under it, a description, and a Tags button

Statsig creates the config and opens its Setup tab. The config starts with one Live version named "Version 1," with an empty System message and an empty User message. Saved changes to Version 1 reach your app right away, because Version 1 is Live.

To turn prompts that you tested in a playground into a config, go to Promote prompts to a config.

Configure a version

Configure a config version on the config's Setup tab. The tab is one page with two groups of settings:

  • Config Setup: The selected version's settings: Version, Custom workflow, Model, Prompt, and Parameters. Choose the version to configure from the Version list.
  • Run Setup: The settings that offline runs use, in the Evaluators, Run Score, Dataset, and Schedule sections. These settings apply to every version of the config. The Schedule section can also start offline runs of the versions you choose every day. For details, go to Schedule daily runs.

Setup tab of the support_bot config with the Config Setup and Run Setup groups in the left nav, Version 1 selected in the Version list, the Create New Version button, the Custom workflow switch, the OpenAI GPT-6.1 Sol model, and System and User prompt messages

To add evaluators, go to Evaluators. Evaluators also decide each run's score. The Run Score section sets how their scores combine. By default, the config's primary evaluator sets the score. For details, go to Set the run score. A critical evaluator fails a run when it scores 0. To add a dataset, go to Add a dataset to a config.

Changes on the Setup tab stay unsaved until you save them. When you have unsaved changes, a save bar appears at the bottom of the screen with the note "Version changes apply to the selected version. Run setup changes apply to all versions." The bar has these buttons:

  • Discard Changes: Undoes your unsaved changes.
  • Save as New Version: Saves a copy of the selected version, with your changes, as a new Draft version, then opens it. The selected version doesn't change, even when it's Live. A message confirms "Saved changes as Version N." This button appears only when the selected version has unsaved changes.
  • Save: Saves your changes.

Both Save and Save as New Version also save your Run Setup changes.

Version 2, a Draft, selected on the Setup tab with Set to Candidate and Promote to Live buttons beside the Version list, and the save bar at the bottom with Discard Changes, Save as New Version, and Save

Choose a model

Under Model, choose a Provider and a Model. Statsig maintains the list of models for each provider: OpenAI, Anthropic, and Google.

Some models limit the other settings:

Statsig charges previews and runs to your Included Credits unless your company has an API key for the provider. Without a key, a notice under Model shows an Add API key link. For details, go to Credits and API keys.

Write the prompt messages

Under Prompt, each message has a role: System, User, or Assistant. Click the role on a message to change it. A config version holds up to 10 messages.

  • To add a message, click Add New Message.
  • To copy or remove a message, open the message's menu and click Clone Prompt or Delete Prompt.

Messages can't be empty. When the config has a dataset, at least one message must reference a dataset column with a variable.

A variable is a dataset column name in double braces, such as {{input}}. In previews and offline runs, Statsig replaces each variable with the row's value from that column. The Variables list under the messages shows every column in the config's dataset. Click a variable to insert it at the cursor. A variable uses underscores where its column name has spaces.

When a column holds JSON, {{column}} inserts the whole value. To insert one field, add a dot path of keys and array indexes, such as {{order.items.0.name}}. A negative index counts from the end of the array. A path that doesn't exist inserts an empty string. A path that points to an object or an array inserts it as JSON.

Prompt section with a System message and a User message that contains the input variable, the Variables list with the input and expected variables, the Add New Message button, and a Prompt Advisor badge that reads Great

Preview output

Results Preview runs the version on the first 5 rows of the config's dataset and shows each output. Use the preview to check a prompt before you start a full run. The preview uses the current settings, including unsaved changes.

To run the preview, click Preview Output under the messages. To run it again after a change, click Reload Preview. The config needs a dataset first. To hide or show the preview table, click the arrow next to Reload Preview.

Results Preview with the input, expected, and Output columns for the first 5 of 10 dataset rows, the Columns menu, and the Reload Preview button with an arrow that hides the table

Running a preview needs permission to edit configs. The Admin and Member project roles have it, and Read-Only doesn't. Without it, the button's tooltip reads "Reach out to your Project Admin for update permissions."

Config and evaluator previews share a limit of 60 per minute for each project. Above the limit, a preview fails with "Too many previews for this project. Please wait a moment and try again." When the model provider rejects a preview request, the "Failed to load results preview" message shows the provider's error.

Improve the prompt with Prompt Advisor

Prompt Advisor uses Statsig AI to rate the prompt messages and suggest a rewrite. When Prompt Advisor is on, a badge under the messages rates them as Weak, Acceptable, or Great.

  1. Click the badge to show the Prompt Suggestion comments.
  2. Click Rewrite with suggestions to get rewritten messages.
  3. Click Apply to replace all of the version's messages with the suggestion.

An admin turns on Prompt Advisor in Settings > Product Configuration > AI Features. In the AI Configs section, turn on Prompt Advisor.

Set parameters

Under Parameters, set the values that Statsig sends to the model. Top P, Frequency Penalty, and Presence Penalty each have a switch. Statsig sends one of these values only when its switch is on.

Each model has its own output limit, up to 128,000 tokens. A Max tokens value above the limit shows "Max tokens must be between 1 and N for this model," where N is the model's limit. An empty Temperature or Max tokens field also shows an error. Either error blocks Save.

Without your own API key for the provider, previews and offline runs on Statsig's keys accept at most 16,384 max tokens. Above that, Statsig rejects them with a message such as "Max tokens above 16384 need your own openai API key. Add one in Settings → Products → General, or lower max tokens." To use a higher value, add your own key in Settings > Product Configuration > General. For details, go to Credits and API keys.

Under Output Format, choose the format of the model's response:

  • Text: Plain text.
  • JSON Object: A JSON object. If no prompt message mentions JSON, the editor warns "Mention JSON in a prompt message. OpenAI models reject JSON Object output when the prompt doesn't ask for JSON." Versions with a custom workflow don't show the warning.
  • Structured Output (JSON Schema): JSON that matches a schema you enter. The schema is a JSON object with a name field and a schema field. The schema field needs type and properties fields.

Call your own endpoint with a custom workflow

A custom workflow sends each row of an offline run to your own endpoint instead of to the model. Use a custom workflow when your app produces the output with more than one model call, such as an agent that calls tools or retrieves documents. Statsig grades your endpoint's response. Your app still receives the version's model and prompt through the SDK.

To set up a custom workflow, open the config's Setup tab and turn on Call your own endpoint for more complex workflows under Custom workflow. Then fill in these fields. The version's Prompt messages become optional.

Statsig sends saved auth header values only to the Workflow URL they were saved with. When you change the URL, each saved value becomes an empty field that reads "Re-enter value for the new URL." Until you re-enter every value, Save and Test Connection stay disabled with the tooltip "Re-enter auth header values for the new workflow URL." To restore the saved values and URL, click Discard Changes.

To check the settings, click Test Connection. Statsig sends one request and shows the response, or the HTTP error code. When you fill in a token field path, a line under the response shows the count that the path finds, such as "Input tokens: 120 · Output tokens: not found." During a run, Statsig records each row's token counts with the run's results, and the results CSV export includes them.

During a run, Statsig adds two headers to each request. x-statsig-eval-run holds the run's ID, so your endpoint can skip side effects for requests from a run. traceparent holds the W3C trace context of the row's trace in Traces. A header that you set with the same name replaces Statsig's. Test Connection doesn't send these headers. To show your endpoint's spans in the row's trace, go to Join a workflow run's trace.

The workflow body accepts dataset columns, such as {{input}}, and these variables from the version:

For example, this body sends the messages, the model, and the row's input column:

json
{
  "messages": {{prompt.prompts}},
  "model": "{{prompt.model}}",
  "question": "{{input}}"
}

The SDK receives the workflow URL, body, and output field path with the version. The headers, auth headers, token field paths, and batch size stay on Statsig's servers.

Manage versions

Each version of a config holds its own model, messages, and parameters. Your app serves the Live version by default, so you can test a change in another version first. Manage versions in the Version section of the config's Setup tab.

Version types

Every version has one of four types. The type decides whether your app receives the version and whether you can promote it.

Create and change versions

To create a version, click Create New Version under the Version list, or open the list and click New version. A new version starts as a Draft copy of the Live version, and Statsig opens it. If the open version has unsaved changes, Statsig still creates the new version, then asks "Are you sure you want to leave?" Click Discard Changes to open the new version. To turn your unsaved changes into a new version instead, click Save as New Version in the save bar.

The menu next to the Version list has these actions:

Next to the menu, buttons change the version's type. The buttons depend on the selected version's type:

  • Set to Candidate: Makes the version available to experiments and overrides. It doesn't serve live traffic.
  • Set to Draft: Makes the version unavailable to experiments and overrides. Not available for a version that an override uses.
  • Promote to Live: Makes the version the Live version that serves traffic. The current Live version becomes a Candidate.

Menu next to the Version list, open on Version 2, a Draft, with Rename Version, Clone Version, Archive Version, and Delete Version, and the Set to Candidate and Promote to Live buttons beside it

Promote a version to Live

Promote to Live compares the run score of the version's latest completed offline run with the run score of the Live version's latest completed offline run. The run score follows the config's run score setting. If the Live version has no completed run, Statsig promotes the version without asking. Otherwise, Statsig asks you to confirm in these cases:

Click Promote Anyway to promote the version.

Edit the Live version

Saving a change to the Live version changes what your app serves right away. If your app fetched the config recently, Statsig asks you to confirm in the Save Changes to Live Version dialog. To test a change before your app serves it, click Save as New Version instead of Save. Statsig saves the change in a new Draft version and leaves the Live version as it was. Then evaluate the new version.

Start an offline run

In an offline run, Statsig runs versions on every row of the config's dataset and grades each output. The config needs a dataset and at least one evaluator first.

  1. In the config's header, click Run Evaluators.
  2. In the Start Evaluation dialog, select the versions to evaluate. Save any changes to a version before you evaluate it.
  3. Click Start Evaluation.

Start Evaluation in support_bot dialog with Version 1 (Live) and Versions 3 and 2 (Candidate) selected, each with its model and the run score of its most recent offline run, and the Start Evaluation button

Statsig opens the first run's page, which updates itself as Statsig grades rows. The other versions' runs are on the Runs tab. While the selected version has a run in progress, Run Evaluators becomes Stop Running, and the Config Setup group shows "Config cannot be edited while evaluators are running." Statsig locks its fields, including the Version list, until the run ends. You can still edit the Run Setup group. For how to read the results, go to Offline Evaluation.

Create an experiment from a config

An experiment serves different versions of a config to different users and compares their metrics. You need at least two versions that are Live or Candidate.

  1. In the config's header, click Create Experiment.
  2. In the Create Experiment dialog, select at least two Live or Candidate versions, then click Create Experiment.
  3. In the experiment form, choose the Control version and one or more Treatment versions.
  4. Name the experiment, add a hypothesis, and create the experiment.

Statsig creates the experiment in the config's layer. The control group serves the Control version. Each Treatment version gets a test group, and Statsig splits traffic evenly across the groups. For each evaluator on the config, Statsig adds a primary metric named <experiment>:<evaluator>. The metric averages the score of the evaluator's grades. It reads statsig::eval_result events with the config's name, is_live set to true, and the evaluator's name. Older experiments created from a config keep metrics that count grades instead.

The experiment appears in the config's header and in the Linked Experiments list in the Details panel. When you create an experiment from the Experiments page instead, the form shows a "Testing prompts or agents?" notice that links to Agent Experimentation.

Other config actions

Besides Run Evaluators and Create Experiment, the config's header has these actions. History, Edit Targeting Rules, and Code Snippets are icon buttons. The other actions are in the header's menu.

Config header with Create Experiment, Run Evaluators, the History, Edit Targeting Rules, and Code Snippets icons, and the header menu open with Clone and Delete

The Included Credits indicator next to the tabs shows the percentage of your Included Credits that your company has used. Hover over the indicator to find the Add API key link. The indicator disappears when your company has an API key for every provider in AI Provider API Keys.

Review results on the Runs and Traces tabs

  • Runs: A table of the config's offline runs, which opens on the Live version's runs, with filters and a chart of evaluator scores. Click a run to open its page, where you can also compare it with another version's run. For details, go to Review results on the Runs tab.
  • Traces: The traces your app sends for the config, with online evaluator scores. For details, go to AI Traces and Online Evaluation.

Runs tab of the support_bot config with a Scores over time chart above a table of Version 1's runs, with Timestamp, Score, Name, Rows, Dataset, and Run Group columns, and the Evaluator, Score, Version, and Status filters in the left rail

Serve a config in your app

Your app fetches a config by its ID with a Statsig AI SDK, then reads the Live version or the Candidate versions. In the Node AI SDK, call getPrompt. In the Python AI SDK, call get_prompt. In the Java AI SDK, call getPrompt. To copy code for a specific config, click Code Snippets in the config's header.

Manage configs programmatically

To create, edit, and evaluate configs from code or from an AI agent, use the Console API or the Statsig MCP server. Console API requests authenticate with a Console API key.

Names in the Console API and MCP

The Console API and the Statsig MCP server use older names for Agent Experimentation objects.

Use the Statsig MCP server

  • MCP V3: Find Agent Experimentation operations with discover_tools, in the prompts and evals categories. For details, go to Agent Experimentation operations.
  • MCP V1: Six tools list, read, create, and update configs, create versions, and start offline runs. V1 has no tools for evaluators, datasets, or run results. For the list, go to the Prompts section of the V1 tool reference.

Was this helpful?

For AI agents: a documentation index is available at /llms.txt. Append .md to any page URL for markdown, or send Accept: text/markdown.

On this page