{"id":4962,"library":"inngest","title":"Inngest Python SDK","description":"The Inngest Python SDK facilitates building and deploying reliable serverless functions and event-driven workflows. It provides tools for defining functions, handling events, and integrating with web frameworks like FastAPI. The library is actively maintained with frequent minor releases, currently at version 0.5.18, and requires Python 3.10 or newer.","status":"active","version":"0.5.18","language":"en","source_language":"en","source_url":"https://github.com/inngest/inngest-py","tags":["workflow","orchestration","background jobs","event-driven","serverless","distributed systems"],"install":[{"cmd":"pip install inngest","lang":"bash","label":"Install core library"}],"dependencies":[{"reason":"Used for making HTTP requests to the Inngest API.","package":"httpx","optional":false},{"reason":"Used for validating event payloads.","package":"jsonschema","optional":false},{"reason":"Used for data modeling and validation of Inngest structures.","package":"pydantic","optional":false}],"imports":[{"symbol":"Inngest","correct":"from inngest import Inngest"},{"symbol":"Event","correct":"from inngest import Event"},{"symbol":"Function","correct":"from inngest import Function"},{"symbol":"Step","correct":"from inngest import Step"},{"note":"Required for integrating with FastAPI applications.","symbol":"InngestFastAPI","correct":"from inngest.framework.fastapi import InngestFastAPI"},{"note":"Required for integrating with Flask applications.","symbol":"InngestFlask","correct":"from inngest.framework.flask import InngestFlask"}],"quickstart":{"code":"import os\nfrom fastapi import FastAPI\nfrom inngest import Inngest, Event, Function, Step\nfrom inngest.framework.fastapi import InngestFastAPI\n\n# Initialize Inngest client\ninngest_client = Inngest(\n    app_id=\"my-python-app\",\n    event_key=os.environ.get('INGEST_EVENT_KEY', ''),\n    signing_key=os.environ.get('INGEST_SIGNING_KEY', ''),\n    # Uncomment for local dev without an Inngest deployment\n    # is_production=False,\n)\n\n# Define an Inngest function\n@inngest_client.function(\n    Function(\n        id=\"hello-world\",\n        name=\"Hello World Function\",\n        trigger=Event(name=\"app/hello.world\"),\n    )\n)\nasync def hello_world(step: Step, event: Event):\n    name = event.data.get(\"name\", \"world\")\n    await step.sleep(\"1s\")\n    message = await step.run(\n        \"say-hello\", lambda: f\"Hello, {name}! This is Inngest from Python.\"\n    )\n    return {\"message\": message}\n\n# Initialize FastAPI app\napp = FastAPI()\n\n# Integrate Inngest with FastAPI\ninngest_fastapi = InngestFastAPI(inngest_client, [hello_world])\napp.include_router(inngest_fastapi.create_router())\n\n# Example endpoint to trigger the Inngest function\n@app.post(\"/trigger\")\nasync def trigger_hello_world(name: str = \"friend\"):\n    await inngest_client.send(Event(name=\"app/hello.world\", data={\"name\": name}))\n    return {\"status\": \"Event sent\", \"name\": name}\n\n# To run this example:\n# 1. pip install fastapi uvicorn inngest\n# 2. Set environment variables: INGEST_EVENT_KEY and INGEST_SIGNING_KEY\n#    (or comment them out and set is_production=False for local-only testing)\n# 3. Run: uvicorn main:app --reload\n# 4. Access Inngest dashboard or send a POST request to /trigger\n","lang":"python","description":"This example sets up a simple Inngest function using FastAPI. The function `hello_world` is triggered by an `app/hello.world` event, sleeps for a second, and returns a greeting. It includes a FastAPI endpoint `/trigger` to manually send this event. Remember to install `fastapi` and `uvicorn`, and set `INGEST_EVENT_KEY` and `INGEST_SIGNING_KEY` environment variables (or disable production mode) to run this."},"warnings":[{"fix":"Upgrade to `inngest>=0.5.17`. This version moves Connect internals into a dedicated thread, improving resilience. However, for best practices, still ensure long-running synchronous operations are offloaded or made asynchronous where possible.","message":"In `Connect` mode, user code that blocked the main thread could cause the Inngest server to perceive the worker as unresponsive or dead, leading to unexpected disconnections or re-runs.","severity":"gotcha","affected_versions":"inngest < 0.5.17"},{"fix":"Upgrade to `inngest>=0.5.15`. Always monitor your Inngest dashboard for successful event ingestion and verify that large payloads are processed correctly. Consider storing large data externally (e.g., S3) and passing references instead of the full payload.","message":"Event payloads larger than 1MB sent via Inngest `Connect` could be silently ignored or truncated without error feedback.","severity":"gotcha","affected_versions":"inngest < 0.5.15"},{"fix":"Upgrade to `inngest>=0.5.15` to resolve issues with parallel step execution. Thoroughly test any workflows utilizing `step.parallel()` after upgrading to confirm desired behavior.","message":"Parallel steps in workflows might not have executed correctly, potentially leading to serial execution or unexpected behavior for functions designed for concurrency.","severity":"gotcha","affected_versions":"inngest < 0.5.15"}],"env_vars":null,"last_verified":"2026-04-12T00:00:00.000Z","next_check":"2026-07-11T00:00:00.000Z"}