Start in 5 minutes

This Monogram guide covers SDK installation, project creation, prompt definition, eval suite execution, and production endpoint deployment. Time: 5 to 10 minutes.

First steps

  • Python 3.9+ or Node.js 18+
  • A Monogram account (sign up free)
  • An API key from Settings > API Keys in your workspace

Step 1: SDK install

Install the Monogram package from PyPI or npm.

bash: Python
pip install monogramml
bash: Node
npm install @monogramml/sdk

Set your API key in an environment variable so the SDK finds it automatically.

bash
export MONOGRAM_API_KEY="your-api-key"

Step 2: Start a project

A project groups related prompts and eval suites. Create one via CLI or web workspace.

python
import monogramml as mgr

# Initialize the client using MONOGRAM_API_KEY env var
client = mgr.Client()

project = client.projects.create(
    name="support-triage",
    description="Ticket classification and priority assignment"
)
print(project.id)  # "proj_k8fna2..."

Step 3: Version a prompt

Prompts have named versions. Variables use double-brace syntax and schema-level types.

python
prompt = client.prompts.create(
    project_id=project.id,
    name="triage-v1",
    template="""You are a support specialist for {{product}}.
Classify the following ticket as P0 (critical), P1 (high), or P2 (standard).
Respond with a JSON object: {"priority": "P0"|"P1"|"P2", "reason": "..."}.

Ticket: {{ticket_text}}""",
    variables={
        "product": "string",
        "ticket_text": "string"
    },
    message="initial version"
)

Step 4: Run evals

Define test cases, expected outputs, and a scoring rubric, then run the suite on your prompt.

python
suite = client.evals.create_suite(
    project_id=project.id,
    name="priority-accuracy",
    rubric="Accuracy: parsed priority must match expected_priority",
    cases=[
        {
            "inputs": {
                "product": "Acme SaaS",
                "ticket_text": "Production is down, all users locked out"
            },
            "expected_priority": "P0"
        },
        {
            "inputs": {
                "product": "Acme SaaS",
                "ticket_text": "Can we add a dark mode setting?"
            },
            "expected_priority": "P2"
        }
    ]
)

run = client.evals.run(
    suite_id=suite.id,
    prompt_id=prompt.id,
    model="openai/gpt-4o"
)
print(run.score)   # e.g. 0.94
print(run.status)  # "pass" or "fail"

Step 5: Deploy to prod endpoint

After a prompt passes its eval gate, deploy it to a Monogram endpoint or push it to an external target.

python
# Deploy the prompt. Eval gate is checked before deploy proceeds.
deployment = client.deployments.create(
    prompt_id=prompt.id,
    eval_suite_id=suite.id,
    target="monogram-endpoint",
    rollout_pct=10  # start at 10% traffic
)

print(deployment.status)    # "deploying" | "live" | "gate_failed"
print(deployment.endpoint)  # "https://api.monogramml.com/v1/infer/..."

Then call the deployed endpoint from your application:

python
result = client.infer.run(
    endpoint=deployment.endpoint,
    variables={
        "product": "Acme SaaS",
        "ticket_text": request.body["ticket"]
    }
)
print(result.output)  # {"priority": "P1", "reason": "..."}

Next steps