Cloud Functions Architecture and Tooling
A deeper look at how Cloud Functions run, the tools that power them, and what happens between a caller's request and a function's response.
New here?If you haven't already, start with What is a Cloud Function? for the high-level picture. This page goes one level deeper, into the runtime, the tooling, and the request lifecycle.
Runtime architecture
A Cloud Function is hosted by the Ingress — the ixoncdkingress Python package, which performs the following actions:
- It runs an HTTP server;
- Routes incoming calls to the correct Python function;
- Injects a
FunctionContextobject so your function has everything it needs to do its work: resources, configuration, an API client, and clients for Document Store and Object Storage.
Local development vs. cloud deployment
The same Cloud Function code runs in two architecturally different environments. Knowing the differences helps you debug, configure, and deploy with confidence.
Local development
When you run make run, the Makefile orchestrates the following:
- Sets up a Python virtual environment in
./venvif one doesn't already exist, using your installed Python 3.12+. - Installs dependencies from
requirements.txtandrequirements-dev.txtinto the venv. Your function's runtime dependencies live inrequirements.txt; development-only tools live inrequirements-dev.txt. - Starts a MongoDB Docker container to provide a local Document Store. This is why Docker is a prerequisite — without it, Document Store calls will fail locally.
- Starts the Ingress by running
python -m ixoncdkingresswithCBC_PATH=./functions. The Ingress listens onhttp://127.0.0.1:8020/and exposes thefunctions/directory as the module root for callable functions. - Loads
context_values.yamlso any config you define there is available locally viacontext.config.
The local Document Store resets on every restart. The Ingress also auto-reloads your function code on save, so you don't need to restart the server to test small edits.
Cloud deployment
In IXON Cloud, the architecture is the same in shape but the moving parts are managed for you:
- The Ingress runs in IXON Cloud's infrastructure, not on your machine.
- The Document Store uses persistent, per-function MongoDB collections.
- Configuration comes from the encrypted Settings stored under Admin > Apps > (your function) > More options > Settings.
context_values.yamlis not used in the cloud. - API access scopes are enforced. A deployed Cloud Function cannot call IXON API resources by default — you must grant scopes under Studio > Cloud Functions > (your function) > API Access.
- Logs are captured and can be downloaded under Studio > Cloud Functions > (your function) > More options > Download logs.
Configuration parityUse the same configuration schema locally and in the cloud, or your function may behave differently in production than in development. Treat
context_values.yamlas a stand-in for the encrypted Settings, not a separate concept.
Tooling
| Tool | Role |
|---|---|
| Python 3.12+ | The language Cloud Functions are written in. ixoncdkingress 1.x requires Python 3.12 or higher. |
ixoncdkingress | The Python package that runs the function host, builds the FunctionContext, and provides the Document Store client. Published on PyPI. |
| Docker | Used during local development to run a MongoDB container for the local Document Store. Not needed in the cloud. |
| Makefile | Orchestrates venv setup, dependency installation, and starting the Ingress. Do not modify — it is part of the workspace contract. |
| venv | Isolates your function's Python dependencies from the system Python. Created automatically by make run. |
requirements.txt | Your function's runtime dependencies. Always pin ixoncdkingress to a specific version. |
The FunctionContext
Every exposed function receives a FunctionContext as its first argument. The FunctionContext is the single entry point to everything your function needs at runtime: who's calling, what configuration is in effect, and how to talk to data stores or APIs.
from ixoncdkingress.function.context import FunctionContext
@FunctionContext.expose
def my_function(context: FunctionContext, **kwargs):
# context.user, context.company, context.agent, context.asset
# context.config
# context.api_client
# context.document_db_client
...Only functions decorated with @FunctionContext.expose are callable from outside the workspace — undecorated helpers stay private.
For the full surface area of FunctionContext, see the SDK reference.
Request lifecycle
Let's take the greet function found in the backend-component-workspace as an example. Here's what happens between a caller pressing a button and your function returning a result:
- The caller invokes the function. A UI Component calls
client.call('functions.example.greet', {...}); a backend caller invokes the equivalent endpoint via the IXON API. - IXON Cloud authenticates the caller and verifies they are allowed to call this function in this context.
- The Ingress builds the FunctionContext. Resources are populated based on where the caller is: a Device Page contributes
context.agent; an Asset Page contributescontext.asset; the active company always contributescontext.company. Configuration is loaded from the encrypted Settings. - The Ingress dispatches to your code. The dotted path
functions.example.greetresolves to thegreetfunction infunctions/example.py. - Your function executes. It may read or write to the Document Store, call the IXON API, call an external service, or simply transform its inputs.
- The return value is serialised to JSON and sent back to the caller. Exceptions are caught, logged, and returned as errors.
Versioning
A Cloud Function in IXON Cloud has a current version. When you deploy a new version, subsequent calls use the new code. Downloadable logs cover the current version only, for the last 48 hours of calls.
Updated about 11 hours ago
