Python SDK for the Sigil persona registry - inject personas into LLM system prompts
Project description
sigil-agent
Python SDK for the Sigil persona registry. Pull personas and inject them into LLM system prompts.
Installation
pip install sigil-agent
Quick Start
from sigil import SigilClient
# Initialize client
client = SigilClient(api_key="sk_...", base_url="https://api.sigil.l8ntlabs.com")
# Fetch a persona
persona = client.get("staccato")
# Inject into system prompt
system_prompt = persona.inject()
# Or combine with a base prompt
system_prompt = persona.inject(base="You are a helpful assistant.")
Usage
Fetching Personas
from sigil import SigilClient
client = SigilClient(api_key="sk_...")
# Get latest version
persona = client.get("staccato")
# Pin a specific version
persona = client.get("staccato", version="1.0.0")
Accessing Persona Fields
persona = client.get("staccato")
# Core fields
print(persona.name) # "staccato"
print(persona.version) # "1.0.0"
print(persona.soul) # The full soul/system text
# Voice configuration
print(persona.voice.tone) # ["direct", "clear"]
print(persona.voice.dos) # ["Be brief", ...]
print(persona.voice.donts) # ["Ramble", ...]
# Values (sorted by priority)
for value in persona.values:
print(f"{value.name}: {value.description} (priority: {value.priority})")
# Behavioral map
for key, behavior in persona.behavioral_map.items():
print(f"{key}: {behavior.posture}")
Injecting into Prompts
The inject() method composes a well-formatted system prompt:
# Basic injection
system_prompt = persona.inject()
# With a base prompt prepended
system_prompt = persona.inject(base="You are an AI assistant for Acme Corp.")
The inject method combines:
- Base prompt (if provided)
- Soul text
- Voice rules (tone, dos, donts, example phrases)
- Values (sorted by priority)
- Behavioral guidelines
Configuration
Environment Variables
export SIGIL_API_KEY="sk_..."
export SIGIL_BASE_URL="https://api.sigil.l8ntlabs.com"
# Client will use env vars if not provided
client = SigilClient()
Client Options
client = SigilClient(
api_key="sk_...", # Required (or SIGIL_API_KEY env var)
base_url="http://...", # Default: http://localhost:8100
timeout=10, # Request timeout in seconds
)
Error Handling
from sigil import SigilClient, SigilError, SigilNotFoundError, SigilAuthError
client = SigilClient(api_key="sk_...")
try:
persona = client.get("nonexistent")
except SigilNotFoundError:
print("Persona not found")
except SigilAuthError:
print("Invalid API key")
except SigilError as e:
print(f"API error: {e.message} (status: {e.status_code})")
Development
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Type checking
mypy sigil
# Linting
ruff check sigil tests
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sigil_agent-0.1.0.tar.gz
(10.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sigil_agent-0.1.0.tar.gz.
File metadata
- Download URL: sigil_agent-0.1.0.tar.gz
- Upload date:
- Size: 10.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14335bfde68d5952038ef87ced6800165cb7dbf52df8f33f1ee17f5721599562
|
|
| MD5 |
913b3be62cf0a2274213c665ff11fc51
|
|
| BLAKE2b-256 |
91135b4edbfc0b7e12742af0cd643c39c1f0b3914c8d3f0effa0c80dc4036c53
|
File details
Details for the file sigil_agent-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sigil_agent-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0110d48ba8e1499bc1f166f22524c06cde9e5cacf2efe1a6e04d3d48cde8364f
|
|
| MD5 |
832ee9f14216f558332a5b6304738164
|
|
| BLAKE2b-256 |
6bdfce8df9ffdb72095e2fa0329378b43c699f5082de876771ff67ae29a79a58
|