# aws/aws-lambda-python-runtime-interface-client architecture

> Architecture diagram of the GitHub repository aws/aws-lambda-python-runtime-interface-client, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aws/aws-lambda-python-runtime-interface-client
- Repository: https://github.com/aws/aws-lambda-python-runtime-interface-client

## Overview

The repository is the AWS Lambda Python Runtime Interface Client: it starts a user handler, obtains invocation events from the Lambda Runtime API, constructs invocation context, runs the handler, and reports its result or error. The graph includes standard and multi-concurrent execution, serialization, initialization hooks, logging, and the documented local-emulator use. Source excerpts establish the main calls; unsampled subsystem links are omitted where the README does not document them.

Main entry points: [`awslambdaric/bootstrap.py`](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/bootstrap.py) (Runtime bootstrap), [`awslambdaric/__main__.py`](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/__main__.py) (CLI launcher), [`awslambdaric/lambda_runtime_client.py`](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_client.py) (Runtime API client), [`awslambdaric/lambda_multi_concurrent_utils.py`](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_multi_concurrent_utils.py) (Worker orchestration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Runtime entry"]
  node_launcher["CLI launcher<br/>[__main__.py]"]
  node_configuration["Runtime configuration<br/>[lambda_config.py]"]
  node_bootstrap["Runtime bootstrap<br/>[bootstrap.py]"]
end

subgraph group_invoke["Invocation processing"]
  node_context["Invocation context<br/>[lambda_context.py]"]
  node_client["Runtime API client"]
  node_native["Native transport<br/>[runtime_client.cpp]"]
  node_marshaller["JSON marshalling"]
end

subgraph group_support["Runtime support"]
  node_faults["Runtime faults"]
  node_logging["Runtime logging"]
  node_literals["Runtime warnings<br/>[lambda_literals.py]"]
  node_hooks["Snapshot hooks"]
end

subgraph group_concurrency["Concurrent execution"]
  node_concurrent["Worker orchestration"]
  node_fork_hooks["Pre-fork hooks"]
  node_concurrent_client["Concurrent API client"]
end

node_function(("User handler"))
node_lambda_api{{"Lambda Runtime API"}}
node_local_emulator{{"Runtime Interface Emulator"}}

node_launcher -->|"loads settings"| node_configuration
node_launcher -->|"starts runtime"| node_bootstrap
node_launcher -->|"dispatches mode"| node_concurrent
node_configuration -->|"provides options"| node_launcher
node_bootstrap -->|"polls and reports"| node_client
node_bootstrap -->|"constructs context"| node_context
node_bootstrap -->|"invokes handler"| node_function
node_bootstrap -->|"marshals payloads"| node_marshaller
node_bootstrap -->|"formats failures"| node_faults
node_bootstrap -->|"configures logging"| node_logging
node_bootstrap -->|"loads warnings"| node_literals
node_bootstrap -.->|"runs lifecycle hooks"| node_hooks
node_client -->|"polls and posts"| node_native
node_client -->|"encodes payloads"| node_marshaller
node_client -->|"raises runtime faults"| node_faults
node_native -.->|"exchanges invocations"| node_lambda_api
node_concurrent -->|"runs workers"| node_bootstrap
node_concurrent -->|"creates client"| node_concurrent_client
node_concurrent -->|"runs registered hooks"| node_fork_hooks
node_concurrent_client -->|"polls and posts"| node_native
node_local_emulator -.->|"starts local runtime"| node_launcher

click node_launcher "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/__main__.py"
click node_configuration "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_config.py"
click node_bootstrap "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/bootstrap.py"
click node_context "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_context.py"
click node_client "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_client.py"
click node_native "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/runtime_client.cpp"
click node_marshaller "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_marshaller.py"
click node_faults "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_exception.py"
click node_logging "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_log_utils.py"
click node_literals "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_literals.py"
click node_hooks "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_hooks_runner.py"
click node_concurrent "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_multi_concurrent_utils.py"
click node_fork_hooks "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_concurrency_hooks.py"
click node_concurrent_client "https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_client.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_launcher,node_configuration,node_bootstrap,node_function toneBlue
class node_context,node_client,node_native,node_marshaller toneAmber
class node_faults,node_logging,node_literals,node_hooks,node_lambda_api toneMint
class node_concurrent,node_fork_hooks,node_concurrent_client toneRose
class node_local_emulator toneIndigo
```

## Components

### Runtime entry

- [CLI launcher](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/__main__.py): `awslambdaric/__main__.py`
- [Runtime configuration](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_config.py): `awslambdaric/lambda_config.py`
- [Runtime bootstrap](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/bootstrap.py): `awslambdaric/bootstrap.py`

### Invocation processing

- [Invocation context](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_context.py): `awslambdaric/lambda_context.py`
- [Runtime API client](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_client.py): `awslambdaric/lambda_runtime_client.py`
- [Native transport](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/runtime_client.cpp): `awslambdaric/runtime_client.cpp`
- [JSON marshalling](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_marshaller.py): `awslambdaric/lambda_runtime_marshaller.py`

### Runtime support

- [Runtime faults](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_exception.py): `awslambdaric/lambda_runtime_exception.py`
- [Runtime logging](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_log_utils.py): `awslambdaric/lambda_runtime_log_utils.py`
- [Runtime warnings](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_literals.py): `awslambdaric/lambda_literals.py`
- [Snapshot hooks](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_hooks_runner.py): `awslambdaric/lambda_runtime_hooks_runner.py`

### Concurrent execution

- [Worker orchestration](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_multi_concurrent_utils.py): `awslambdaric/lambda_multi_concurrent_utils.py`
- [Pre-fork hooks](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_concurrency_hooks.py): `awslambdaric/lambda_concurrency_hooks.py`
- [Concurrent API client](https://github.com/aws/aws-lambda-python-runtime-interface-client/blob/main/awslambdaric/lambda_runtime_client.py): `awslambdaric/lambda_runtime_client.py`

### Other components

- **User handler**
- **Lambda Runtime API**
- **Runtime Interface Emulator**

## Connections

- CLI launcher → Runtime configuration: loads settings (evidence: `awslambdaric/__main__.py`)
- CLI launcher → Runtime bootstrap: starts runtime (evidence: `awslambdaric/__main__.py`)
- CLI launcher → Worker orchestration: dispatches mode (evidence: `awslambdaric/__main__.py`)
- Runtime configuration → CLI launcher: provides options (evidence: `awslambdaric/__main__.py`)
- Runtime bootstrap → Runtime API client: polls and reports (evidence: `awslambdaric/bootstrap.py`)
- Runtime bootstrap → Invocation context: constructs context (evidence: `awslambdaric/bootstrap.py`)
- Runtime bootstrap → User handler: invokes handler (evidence: `awslambdaric/bootstrap.py`)
- Runtime bootstrap → JSON marshalling: marshals payloads (evidence: `awslambdaric/bootstrap.py`)
- Runtime bootstrap → Runtime faults: formats failures (evidence: `awslambdaric/bootstrap.py`)
- Runtime bootstrap → Runtime logging: configures logging (evidence: `awslambdaric/bootstrap.py`)
- Runtime bootstrap → Runtime warnings: loads warnings (evidence: `awslambdaric/bootstrap.py`)
- Runtime bootstrap → Snapshot hooks: runs lifecycle hooks (evidence: `awslambdaric/bootstrap.py`)
- Runtime API client → Native transport: polls and posts (evidence: `awslambdaric/lambda_runtime_client.py`)
- Runtime API client → JSON marshalling: encodes payloads (evidence: `awslambdaric/lambda_runtime_client.py`)
- Runtime API client → Runtime faults: raises runtime faults (evidence: `awslambdaric/lambda_runtime_client.py`)
- Native transport → Lambda Runtime API: exchanges invocations
- Worker orchestration → Runtime bootstrap: runs workers (evidence: `awslambdaric/lambda_multi_concurrent_utils.py`)
- Worker orchestration → Concurrent API client: creates client (evidence: `awslambdaric/lambda_multi_concurrent_utils.py`)
- Worker orchestration → Pre-fork hooks: runs registered hooks (evidence: `awslambdaric/lambda_multi_concurrent_utils.py`)
- Concurrent API client → Native transport: polls and posts (evidence: `awslambdaric/lambda_runtime_client.py`)
- Runtime Interface Emulator → CLI launcher: starts local runtime (evidence: `README.md`)
