PromptsApr 7, 2026·2 min read

Ell — Prompt Engineering as Code in Python

Treat prompts as versioned Python functions with automatic tracking, visualization, and A/B testing. Like Git for your AI prompts with a beautiful studio UI.

SC
Script Depot · Community
Quick Use

Use it first, then decide how deep to go

This block should tell both the user and the agent what to copy, install, and apply first.

pip install ell-ai
import ell

@ell.simple(model="claude-sonnet-4-20250514")
def summarize(text: str) -> str:
    "You are a concise summarizer."
    return f"Summarize this: {text}"

result = summarize("Long article text here...")
print(result)

What is Ell?

Ell treats prompts as versioned, typed Python functions instead of opaque strings. Every prompt call is automatically tracked with inputs, outputs, and metadata — viewable in Ell Studio, a local visualization tool. It brings software engineering practices (versioning, testing, monitoring) to prompt engineering.

Answer-Ready: Ell is a Python library that treats AI prompts as versioned functions with automatic tracking, visualization in Ell Studio, and A/B testing. It brings software engineering practices to prompt engineering. 6k+ GitHub stars.

Best for: Teams iterating on prompts who need versioning and analytics. Works with: OpenAI, Anthropic, any OpenAI-compatible API. Setup time: Under 2 minutes.

Core Features

1. Prompts as Functions

import ell

@ell.simple(model="claude-sonnet-4-20250514")
def write_poem(topic: str) -> str:
    "You are a creative poet."
    return f"Write a short poem about {topic}"

# Every call is tracked automatically
poem = write_poem("sunset")

2. Complex Prompts (Multi-Message)

@ell.complex(model="claude-sonnet-4-20250514")
def chat(history: list[ell.Message]) -> list[ell.Message]:
    return [
        ell.system("You are a helpful assistant."),
        *history,
    ]

3. Ell Studio — Visual Dashboard

ell-studio --storage ./ell_logs
# Opens http://localhost:8000

Studio shows:

  • Version history of each prompt function
  • Input/output pairs for every call
  • Latency and token usage metrics
  • Diff view between prompt versions

4. Automatic Versioning

Ell detects when you change a prompt function and creates a new version:

# Version 1
@ell.simple(model="claude-sonnet-4-20250514")
def greet(name: str):
    "You are friendly."
    return f"Say hi to {name}"

# Version 2 (auto-detected)
@ell.simple(model="claude-sonnet-4-20250514")
def greet(name: str):
    "You are friendly and enthusiastic."
    return f"Enthusiastically greet {name}"

5. Multimodal Support

from PIL import Image

@ell.simple(model="gpt-4o")
def describe_image(image: Image.Image):
    return [
        ell.system("Describe this image in detail."),
        ell.user(["What do you see?", image]),
    ]

Why Use Ell?

Without Ell With Ell
Prompts as strings in code Prompts as typed functions
Manual copy-paste to track changes Automatic version control
No visibility into prompt performance Studio dashboard with metrics
Hard to compare prompt variants Built-in A/B comparison

FAQ

Q: How does it compare to LangChain? A: Ell is focused purely on prompt engineering — versioning, tracking, and iteration. LangChain is a broader framework for chains and agents.

Q: Does it work with Claude? A: Yes, Anthropic Claude is fully supported.

Q: Where is the data stored? A: Locally in SQLite (default: ./ell_logs/). No data sent externally.

🙏

Source & Thanks

Created by William Guss. Licensed under MIT.

MadcowD/ell — 6k+ stars

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets