gevent

Python concurrency library using greenlets (cooperative coroutines) with monkey-patching to make blocking stdlib calls non-blocking. gevent.monkey.patch_all() transparently makes socket, threading, and I/O operations async without code changes — existing synchronous code becomes concurrent. Powers Gunicorn's gevent worker and used in legacy Python services for I/O concurrency without async/await syntax.

Evaluated Mar 06, 2026 (0d ago) v23+
Homepage ↗ Repo ↗ Developer Tools greenlet coroutine networking monkey-patch python gunicorn concurrency libev
⚙ Agent Friendliness
62
/ 100
Can an agent use this?
🔒 Security
94
/ 100
Is it safe for agents?
⚡ Reliability
81
/ 100
Does it work consistently?

Score Breakdown

⚙ Agent Friendliness

MCP Quality
--
Documentation
75
Error Messages
68
Auth Simplicity
100
Rate Limits
100

🔒 Security

TLS Enforcement
100
Auth Strength
100
Scope Granularity
100
Dep. Hygiene
78
Secret Handling
85

Local execution. Monkey-patching modifies SSL/TLS socket behavior globally — verify TLS certificate validation still works correctly after patch_all() in production.

⚡ Reliability

Uptime/SLA
100
Version Stability
78
Breaking Changes
75
Error Recovery
70
AF Security Reliability

Best When

You have legacy synchronous Python code that needs I/O concurrency without a full async rewrite — monkey-patching provides concurrency with minimal code changes.

Avoid When

Starting a new project — use asyncio or Trio. gevent is a pragmatic solution for legacy code, not a first choice for greenfield work.

Use Cases

  • Add concurrency to existing synchronous Python code bases without rewriting to async/await — monkey-patch once and get greenlet-based concurrency
  • Run high-concurrency Gunicorn web servers with gevent workers for I/O-bound workloads without migrating to ASGI
  • Build concurrent web scrapers using gevent's gevented requests/urllib without async code — spawn thousands of greenlets for parallel HTTP
  • Parallelize I/O-bound agent operations (file reads, network calls) in legacy codebases that can't adopt asyncio
  • Create event-driven socket servers with gevent.server.StreamServer for high-connection-count TCP services

Not For

  • New Python projects — use asyncio or Trio for new code; gevent's monkey-patching approach is legacy and harder to reason about
  • CPU-bound parallelism — gevent uses cooperative coroutines in a single thread; use multiprocessing or Joblib for CPU-bound work
  • Code that interacts with C extensions that don't release the GIL — monkey-patching won't help with C-level blocking calls

Interface

REST API
No
GraphQL
No
gRPC
No
MCP Server
No
SDK
Yes
Webhooks
No

Authentication

Methods: none
OAuth: No Scopes: No

No authentication — local Python library.

Pricing

Model: open_source
Free tier: Yes
Requires CC: No

gevent is open source and free.

Agent Metadata

Pagination
none
Idempotent
Partial
Retry Guidance
Not documented

Known Gotchas

  • gevent.monkey.patch_all() must be called BEFORE any other imports that use socket/threading — import order is critical; call at the very top of main module
  • Monkey-patching incompatible with some C extensions (psycopg2 without green mode, some SSL libraries) — test thoroughly; subtle bugs can appear under load
  • CPU-bound greenlets starve all others since cooperative scheduling requires explicit yield points (gevent.sleep(0)) — use threads for CPU-heavy work
  • gevent.pool.Pool size must be tuned — unlimited greenlets (Pool(None)) can exhaust file descriptors and memory on high-traffic systems
  • Greenlet stack traces are harder to read than regular Python tracebacks — gevent provides gevent.util.print_run_info() for debugging stuck greenlets
  • The requests library works with gevent after monkey-patch, but urllib3's connection pool may need explicit gevent pool patching for correct behavior

Alternatives

Full Evaluation Report

Detailed scoring breakdown, competitive positioning, security analysis, and improvement recommendations for gevent.

$99

Scores are editorial opinions as of 2026-03-06.

5210
Packages Evaluated
26151
Need Evaluation
173
Need Re-evaluation
Community Powered