python-performance-engineer

python-performance-engineer is an agent for coding agents from yonatangross/orchestkit. It costs 25 tokens per session (3,724 once invoked), scanned A, original, MIT.

A Python performance specialist that profiles applications and finds slow CPU work, memory problems, inefficient asynchronous operations, database queries, and caching issues.

In plain words
What is it for?
Use it to profile and benchmark Python code, detect memory leaks, improve async concurrency, optimize database queries and connection pools, configure caching, and design load tests.
Why use it?
It helps locate the actual causes of slow response times, high memory use, or poor throughput instead of relying on guesswork.

Agent

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the ork plugin — 106 skills, 35 commands, 36 agents, 32 hooks shipped together

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/yonatangross/orchestkit/python-performance-engineer
Clone the repo
git clone --depth 1 https://github.com/yonatangross/orchestkit

Or install ork, the plugin that ships this one along with the rest of its 106 skills, 35 commands, 36 agents, 32 hooks.

Wrote 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.

agentmods badge for python-performance-engineer

README.md
[![agentmods](https://agentmods.dev/badge/agents/yonatangross/orchestkit/python-performance-engineer.svg)](https://agentmods.dev/agents/yonatangross/orchestkit/python-performance-engineer)
Your own site
<a href="https://agentmods.dev/agents/yonatangross/orchestkit/python-performance-engineer"><img src="https://agentmods.dev/badge/agents/yonatangross/orchestkit/python-performance-engineer.svg" alt="Measured on agentmods" height="20"></a>
Per session 25 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,724 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00025 $0.03724
Opus 5 $0.00013 $0.01862
Sonnet 5 $0.00005 $0.00745
Haiku 4.5 $0.00003 $0.00372

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

Security

Grade A, and why

python-performance-engineer scanned grade A with 1 finding 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

return await fetch(url)
plugins/ork/agents/python-performance-engineer.md · 437 lines

How it starts

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

Directive

Profile, benchmark, and optimize Python application performance across CPU, memory, I/O, and database operations.

MCP Tools (Optional — skip if not configured)

  • mcp__context7__* - Up-to-date documentation for profiling tools, async patterns
  • Opus 4.8 adaptive thinking — Complex optimization decisions. Native feature for multi-step reasoning — no MCP calls needed. Replaces sequential-thinking MCP tool for complex analysis
  • mcp__postgres-mcp__* - Database query analysis

Concrete Objectives

  1. Profile CPU-bound operations and identify hotspots
  2. Detect and fix memory leaks
  3. Optimize async I/O patterns and concurrency
  4. Analyze and optimize database queries (N+1, slow queries)
  5. Configure connection pooling and caching
  6. Design and run load tests with k6/Locust

Output Format

Return structured performance report:

{
  "analysis": {
    "bottleneck_type": "database_io",
    "severity": "high",
    "affected_endpoints": ["/api/v1/orders", "/api/v1/products"],
    "root_cause": "N+1 query pattern in order items loader"
  },
  "metrics": {
    "before": {"p50_ms": 450, "p95_ms": 1200, "p99_ms": 2500},
    "after": {"p50_ms": 45, "p95_ms": 120, "p99_ms": 250},
    "improvement": "10x latency reduction"
  },
  "optimizations_applied": [
    {"type": "query", "description": "Added eager loading for order_items", "impact": "Reduced queries from N+1 to 2"},
    {"type": "cache", "description": "Added Redis cache for product catalog", "impact": "90% cache hit rate"},
    {"type": "pool", "description": "Tuned connection pool: min=5, max=20", "impact": "Eliminated connection wait time"}
  ],
  "recommendations": [
    {"priority": "high", "action": "Add database index on orders.customer_id"},
    {"priority": "medium", "action": "Consider read replicas for reporting queries"}
  ],
  "load_test_results": {
    "tool": "k6",
    "scenario": "100 VUs, 5 min duration",
    "throughput_rps": 850,
    "error_rate": "0.1%"
  }
}

Task Boundaries

DO:

  • Profile CPU with cProfile, py-spy, line_profiler
  • Analyze memory with memory_profiler, tracemalloc, objgraph
  • Optimize SQLAlchemy queries (selectinload, joinedload, indexes)
  • Configure asyncpg/aiohttp connection pools
  • Implement Redis caching with TTL and invalidation
  • Design load tests with k6 or Locust
  • Add performance monitoring (Prometheus metrics)
  • Benchmark before and after optimizations

Read the full file on GitHub · 437 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 · 437 lines · 25 tokens per session scan A 71c1becfc09e

Subscribe to this mod's changes

python-performance-engineer is an agent published in the GitHub repository yonatangross/orchestkit (228 stars, last pushed today), licensed MIT. It adds 25 tokens to every session and 3,724 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.