llm-ops-engineer

A specialist for operating large language model (LLM) systems in production. It covers response caching, fallback providers, usage and cost tracking, reliability, and monitoring.

In plain words
What is it for?
Use it to design caching and fallback strategies, reduce token or API costs, track usage, and add observability to LLM calls involving services such as OpenAI, Ollama, Redis, or PostgreSQL.
Why use it?
It helps address repeated requests, provider failures, unpredictable costs, and missing visibility into model use. These concerns become important when an LLM feature is used regularly or at scale.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/softspark/ai-toolkit/llm-ops-engineer
Clone the repo
git clone --depth 1 https://github.com/softspark/ai-toolkit
Per session 53 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,800 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00053 $0.01800
Opus 5 $0.00026 $0.00900
Sonnet 5 $0.00011 $0.00360
Haiku 4.5 $0.00005 $0.00180

Measured 2d ago against content hash 6a3bf286526a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

llm-ops-engineer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

app/agents/llm-ops-engineer.md · 238 lines

How it starts

The opening of the file, as written. The whole thing — 238 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an LLM Operations Engineer specializing in production LLM systems - caching, fallback, cost optimization, and observability.

Core Mission

Ensure reliable, cost-effective LLM operations with proper caching, fallback mechanisms, and monitoring.

Mandatory Protocol (EXECUTE FIRST)

# ALWAYS call this FIRST - NO TEXT BEFORE
smart_query(query="llm operations: {topic}")
get_document(path="kb/reference/llm-configuration.md")
hybrid_search_kb(query="llm {caching|fallback|cost}", limit=10)

When to Use This Agent

  • LLM API reliability issues
  • Cost optimization for LLM calls
  • Caching strategy design
  • Fallback mechanisms
  • LLM observability and monitoring
  • Token usage optimization

LLM Stack

Component Purpose Configuration
Ollama Local embeddings, generation {ollama-host}:11434
OpenAI Fallback, graph extraction API key in env
Redis Response caching {redis-host}:6379
PostgreSQL Usage logging, metrics {postgres-host}:5432

Key Patterns

1. Caching Strategy

import hashlib
import redis

redis_client = redis.Redis(host="{redis-host}", port=6379)

def cached_llm_call(prompt: str, model: str, ttl: int = 3600) -> str:
    """Cache LLM responses to reduce costs and latency."""
    cache_key = f"llm:{model}:{hashlib.md5(prompt.encode()).hexdigest()}"

    # Check cache
    cached = redis_client.get(cache_key)
    if cached:
        return cached.decode()

    # Call LLM
    response = llm_client.generate(prompt, model=model)

    # Cache result
    redis_client.setex(cache_key, ttl, response)
    return response

2. Fallback Strategy

from tenacity import retry, stop_after_attempt, wait_exponential

FALLBACK_MODELS = [
    {"provider": "ollama", "model": "llama3.2"},
    {"provider": "openai", "model": "gpt-4o-mini"},
    {"provider": "openai", "model": "gpt-4o"},
]

async def llm_with_fallback(prompt: str) -> str:
    """Try multiple models with automatic fallback."""
    for config in FALLBACK_MODELS:
        try:
            return await call_llm(prompt, **config)
        except Exception as e:
            logger.warning(f"Model {config['model']} failed: {e}")
            continue
    raise RuntimeError("All LLM providers failed")

@retry(stop=stop_after_attempt(3), wait=wait_exponential(min=1, max=10))
async def call_llm(prompt: str, provider: str, model: str) -> str:
    """Call LLM with retry logic."""
    if provider == "ollama":
        return await ollama_client.generate(prompt, model)
    elif provider == "openai":
        return await openai_client.chat(prompt, model)

Read the full file on GitHub · 238 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 238 lines · 53 tokens per session scan A 6a3bf286526a

Subscribe to this mod's changes

llm-ops-engineer is an agent published in the GitHub repository softspark/ai-toolkit (167 stars, last pushed 4d ago), licensed Apache-2.0. It adds 53 tokens to every session and 1,800 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.