Skip to main content

Create an AIConfig

There are 2 ways to create an aiconfig from scratch.

  1. Using the AIConfig SDK
  2. Using the AI Workbook editor

AIConfig SDK

Create aiconfig programmatically

You can use the create function to create an empty aiconfig. To create prompts in the config, you can use the serialize function, which takes in data in the form that a model expects (e.g. OpenAI completion params), and creates Prompt objects that can be saved in the aiconfig.


Clone this notebook to create an aiconfig programmatically.
import asyncio
from aiconfig import AIConfigRuntime

async def main():
new_config = AIConfigRuntime.create("my_aiconfig", "This is my new AIConfig")

# OpenAI completion params
model = "gpt-4"
data = {
"model": model,
"messages": [
{ "role": "user", "content": "Say this is a test" },
{ "role": "assistant", "content": "This is a test." },
{ "role": "user", "content": "What do you say?" }

# Serialize the data into the aiconfig format.
prompts = await new_config.serialize(model, data, "prompts")

# Add the prompts to the aiconfig
for i, prompt in enumerate(prompts):
new_config.add_prompt(f"prompt_name_{i}", prompt)

# Save the aiconfig to disk'new.aiconfig.json', include_outputs=True)

OpenAI API Python Wrapper

If you're using OpenAI chat models, you can also use introspection to wrap OpenAI API calls and save an aiconfig automatically:

Usage: see openai_wrapper.ipynb.

Now call OpenAI regularly. The results will automatically get saved in new_config:

completion_params = {
"model": "gpt-3.5-turbo",
"temperature": 1,
"messages": [
"role": "user",
"content": "Tell me a joke about config files"

# Updates new_config automatically
response =**completion_params)

# Save results to disk"new.aiconfig.json", include_output=True)

For a complete guide, see the OpenAI API Wrapper notebook.

AI Workbook editor

AI Workbook is a visual notebook editor for aiconfig.


In the Jupyter world, an ipynb is a JSON file, but it's very rare to edit the JSON directly. Most people use the notebook editor which serializes updates into the ipynb.

Using an AI Workbook with an aiconfig is meant to satisfy the same behavior.

  1. Go to
  2. Create a new Workbook
  3. Once you are done, click "..." and select 'Download as AIConfig'

Try out the workbook playground here: NYC Travel Workbook


We are currently working on a local editor that you can run yourself. For now, please use the hosted version on

Editing existing AIConfig

  1. Go to
  2. Go to Workbooks page:
  3. Click dropdown from '+ New Workbook' and select 'Create from AIConfig'
  4. Upload travel.aiconfig.json