Appearance
Quickstart
Get started with Mandatum in 5 minutes.
1. Create Your Account
Sign up at mandatum.netlify.app using Google OAuth.
2. Get Your Mandatum API Key
This key authenticates your application to Mandatum.
- Go to Settings → Mandatum API Keys
- Click Create New API Key
- Copy and store it securely
WARNING
Never commit API keys to version control. Use environment variables.
3. Create Your First Prompt
- Click Prompts in the sidebar
- Click New Prompt
- Name it
hello-world - Select your provider and model (e.g., OpenAI / gpt-4)
- Enter your prompt template:
text
You are a helpful assistant. Say hello to {{name}} in a friendly way.- Click Save
4. Run Your Prompt
SDK-First Approach (Recommended)
With the SDK-first approach, your LLM API keys stay on your system and never touch Mandatum servers. The SDK fetches the prompt template, executes locally, and logs results back.
bash
pip install mandatum openaipython
import os
from openai import OpenAI
from mandatum import Mandatum
# Initialize clients
mandatum = Mandatum(api_key=os.environ["MANDATUM_API_KEY"])
openai_client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
# Run the prompt locally
response = mandatum.prompts.run(
prompt_id="your-prompt-id",
user_input="Hello!",
llm_client=openai_client,
variables={"name": "Alice"},
environment="production",
tags=["greeting"],
)
print(response.output)REST API (Server-Side Execution)
For server-side execution where you've configured provider keys:
bash
# Run the latest version of a prompt
curl -X POST https://mandatum-api.gavelinivar.com/api/v1/prompts/{prompt_id}/run \
-H "X-API-Key: YOUR_MANDATUM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"user_input": "Hello!",
"variables": {"name": "Alice"}
}'Core Features
Prompts
Create, edit, delete, and version your prompt templates.
- Variables: Use
syntax for dynamic content - Versioning: Every save creates a new version you can rollback to
- Multi-provider: Switch between OpenAI, Anthropic, Google without code changes
Integrations (Custom Code)
Write Python scripts that run before or after your LLM calls.
Pre-run scripts transform input before the LLM call:
python
def pre_run(input_variables, metadata):
# Clean up user input
input_variables["message"] = input_variables["message"].strip().lower()
return input_variablesPost-run scripts process the LLM output:
python
def post_run(output, metadata):
# Parse JSON from response
import json
return json.loads(output)Evaluations
Test and compare prompt versions:
- Create test cases with expected outputs
- Run evaluations across prompt versions
- Track quality metrics over time
Request Logging
Every prompt execution is automatically logged:
- Full input/output capture
- Token counts and costs
- Latency measurements
- Custom metadata you attach
View logs in the dashboard or query via API.
Add Metadata
Attach metadata to track requests across your application:
python
response = mandatum.prompts.run(
prompt_id="your-prompt-id",
user_input="Hello!",
llm_client=openai_client,
variables={"name": "Alice"},
metadata={
"user_id": "user_123",
"session_id": "session_456",
"source": "web_app"
}
)Search and filter logs by metadata in the dashboard.