Skip to content

Python 3.13 — Fast

Python 3.13 — Fast gives you instant cold starts with no container spin-up between calls. It trades full PyPI access for speed, offering 283 pre-built packages. Reach for it on latency-sensitive tasks; use the standard Python 3.13 runtime when you need packages outside the curated set or outbound HTTP beyond fetch().

import json
def cortexone_handler(event, context):
result = {"message": "Hello, World!"}
return {"statusCode": 200, "body": json.dumps(result)}

event is the input payload (dict); context holds execution metadata (fn_id, user_id). Return a dict with statusCode and body.

Add a requirements.txt next to cortexone_function.py:

numpy
pandas==2.2.0
scipy>=1.12

Standard version specifiers (==, >=, !=, ~=) work; URL-based dependencies don’t. 283 packages are available (numpy, pandas, scipy, scikit-learn, requests, and many specialized libraries).

On this runtime, read secrets via process["env"], not os.environ:

api_key = process["env"].get("MY_API_KEY", "")

Always available without imports: hash_digest(algorithm, data), btoa/atob, crypto.random_uuid(), crypto.get_random_values(n), json_encode/json_decode, text_encode/text_decode, url_parse, structured_clone, and fetch(url, options) for synchronous HTTP (returns {status, ok, text, json, headers}).

Available: the Python 3.13 standard library, process["env"], execution-scoped file I/O, the built-in utilities, and synchronous fetch. Not available: subprocess/multiprocessing, shutil/venv/pip, dangerous os operations (os.system, os.popen, os.fork), and os.environ (use process["env"]).

512 MB memory, 300-second runtime, 2.0-core CPU. Each execution gets a fresh namespace — no state is shared between calls, and temporary files don’t persist. Exceptions return 500; timeouts return 408; exceeding memory returns 507.