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.
git clone --depth 1 https://github.com/d-padmanabhan/agent-engineering-handbookWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/d-padmanabhan/agent-engineering-handbook/500-ai-ml)<a href="https://agentmods.dev/rules/d-padmanabhan/agent-engineering-handbook/500-ai-ml"><img src="https://agentmods.dev/badge/rules/d-padmanabhan/agent-engineering-handbook/500-ai-ml.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00029 | $0.09377 |
| Opus 5 | $0.00015 | $0.04688 |
| Sonnet 5 | $0.00006 | $0.01875 |
| Haiku 4.5 | $0.00003 | $0.00938 |
Grade A, and why
500-ai-ml 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 4d 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.
How it starts
The opening of the file, as written. The whole thing — 1,533 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AI/ML & LLM Integration Best Practices
Audience: engineers building AI/ML applications, LLM integrations, and AI agents Goal: Reliable, safe, cost-effective AI applications with proper observability and evaluation
AI/ML Philosophy (Core Principles)
Core Principles:
- "Cost-aware by default" - Monitor token usage, choose appropriate models, implement caching
- "Reliability over speed" - Retries, fallbacks, timeouts, graceful degradation
- "Safety first" - Content filtering, prompt injection prevention, guardrails, output validation
- "Observability is essential" - Log prompts, responses, latency, costs, errors
- "Evaluate continuously" - Test outputs, measure quality metrics, A/B test prompts
- "Explicit over implicit" - Clear prompts, explicit instructions, documented assumptions
- "Fail gracefully" - Fallback strategies, error handling, user-friendly messages
- "Version everything" - Version prompts, models, evaluation datasets
Applying AI/ML Principles:
# BAD: No error handling, no cost tracking, no safety checks
def generate_text(prompt: str) -> str:
response = openai.chat.completions.create(
model="gpt-4",
messages=[{"role": "user", "content": prompt}]
)
return response.choices[0].message.content
# GOOD: Error handling, cost tracking, safety checks
def generate_text(
prompt: str,
model: str = "gpt-3.5-turbo",
max_tokens: int = 1000,
) -> tuple[str, dict]:
"""Generate text with error handling and cost tracking."""
# Safety check
if not is_safe_content(prompt):
raise ValueError("Unsafe content detected")
try:
response = openai.chat.completions.create(
model=model,
messages=[{"role": "user", "content": prompt}],
max_tokens=max_tokens,
)
content = response.choices[0].message.content
# Track costs
metrics = {
"input_tokens": response.usage.prompt_tokens,
"output_tokens": response.usage.completion_tokens,
"total_tokens": response.usage.total_tokens,
"model": model,
}
# Safety check output
if not is_safe_content(content):
raise ValueError("Unsafe output generated")
return content, metrics
except openai.RateLimitError:
# Implement retry with backoff
time.sleep(5)
return generate_text(prompt, model, max_tokens)
except Exception as e:
logger.error(f"Generation failed: {e}")
raise
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.
- 4d ago First seen · 1,533 lines · 29 tokens per session scan A 22ba070ebe51
500-ai-ml is a cursor rule published in the GitHub repository d-padmanabhan/agent-engineering-handbook (16 stars, last pushed yesterday), licensed MIT. It adds 29 tokens to every session and 9,377 once invoked, about $0.0001 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-09-03.
Other cursor rules, from other repositories
baml
A set of rules for setting up BAML and help with syntax guidance.
co-dialectic
Co-Dialectic prompt sharpening and verification rules for Cursor.
prompt-routing
Route tasks to the correct Universal AI Engineering Prompt.
prompting-for-qe
Soạn/tinh chỉnh prompt cho tác vụ QE (sinh test case, phân tích requirement, tóm tắt tài liệu test, phân tích log) — đặc biệt khi output AI lan man, chung chung, bịa, hoặc muốn chốt prompt thành template tái dùng.
llm-zod-jsonschema
Best Practice for LLM Output Parsing with Zod and JSON Schema.
prompt-evals
Prompt eval fixtures — case design, assertions, versioning, CI gates, no PII in golden data.