Read the latest blog: Pillars for Implementing Critical Production-Ready AI Learn more
To view the complete documentation, please access via the Lemma console.
There are five core concepts when building workflow automations on the Lemma platform. These include: Workers, States, Functions, Connections, and Secrets.

A Worker is the fundamental unit of a workflow. It represents a complete process defined as a sequence of interconnected States. Workers are immutable to provide safety measures; changes can be made to a Worker by creating and publishing a new version.
The execution of a Worker is called a Run. Each Run maintains its own Context, an internal storage space used to share data between States within that specific Run. Inputs and outputs to States are stored in the Context so they can be shared and accessed across various steps of a Run.
Key Attributes of a Worker:
Name: A title for the Worker.
Version: An immutable copy of the workflow definition.
States: A list of States that define the workflow. Each State defines a transition to the next State, which can create a cyclic or acyclic workflow.
Input and Output Schema: A way to define the structure of the data that is received and sent by a Worker:
Input schema: Ensures that the input data for a Run matches the expected structure.
Output schema: Structures the data to return only the relevant information.
Each published Worker is immediately executable via a unique endpoint and is production ready. Workers are durable, observable, and scalable.



A State represents a single step within a Worker's execution. Each State either performs actions that utilize Functions, pauses or resumes the workflow, or contains logic that determines the flow of execution.
States are powerful logical building blocks that can enable many flexible workflows. For example, Agentic-style workflows can be created by combining certain states types such as a Do/While and a ForEach, with non-deterministic LLM Functions and Functions that you want the LLM to reason across to call.
Some of these recurring patterns are presented in the platform in the form of a Template. Templates are pre-defined Worker configurations that are available for use and further customization. Template availability can be configured per stack.
Key Attributes of a State:
Name: A title for the State.
Transition(s): Every State defines a transition to another State or specifies that the Worker Run will end at the conclusion of the State. A Switch State may define multiple possible transitions, but at most one transition will occur for a given state.
Retry Policy: Defines how many times to retry the State when the original attempt times out or fails. Retry policies can also be configured on the Function level.
Timeout(s) : Every State can support a different timeout or use default timeouts to support various Worker runtime behaviors.
[BETA] Fallback(s) : Fallbacks allow for the support of backup Functions to be called in the event that the primary Function fails or times out. This is used often for AI Functions to reduce production dependency on a single AI provider or to counter token-limitations.
Types of States:
Call: Executes a standalone, singular function, like making an API call or another Worker.
Switch: Contains logic that change the path or order of Worker execution depending on the input prior to the State.
Parallel: Allows you to execute multiple Functions concurrently, and requires you to still remain in the Parallel state.
Do/Listen: Pauses the Run until the workflow is signaled with incoming data that matches a predefined schema.
Do/While: Executes a function or functions, until a pre-defined condition is met.
ForEach: Executes the same function or functions on each element of a collection of input data. A ForEach state can be configured to run in parallel or sequentially.
Handoff: Pauses the Run and waits for human intervention to resume the Run, subject to preconfigured timeouts. A Handoff can be configured to send a Notification to users. Users can pass data back into the Handoff via the Notification to resume the Run, capturing human feedback and input.
Notifications allow you to set different ways on how Workers can communication to users inside of a Workflow. Examples include SMS, WhatsApp, Email, and Webhook. The data coming back from a Notification can be captured via voice, text, or an action.
You can set whether a user can unpause a Run via an outside channel (e.g. texting back a response) or whether they have to log into the Lemma console to take an action.



A Function performs a specific action within a State by making an API call. Functions are designed to be modular and easily integrated into different Workers. The Lemma platform supports multiple protocols for Functions (e.g. REST, gRPC).
Key Attributes of a Function:
Endpoint: The URL which the API call will be sent to.
Input Schema: The definition of the expected structure of the input data.
Output Schema: The definition of the expected structure of the output data.
Required Authentication(s): The authentication type(s) required by the server (OAuth, API Key, etc).
Version: An immutable copy of the Function definition, which includes all the attributes above. Like Workers, Functions are immutable to provide safety around execution. Changes for Functions are also made by publishing new versions of Functions.
Examples
An API call to the AWS Transcribe service to transcribe an audio file and receive text as output.
An API call to the Google Vertex AI API to extract the summary of a PDF with Gemini 1.5 Pro model.
These Function definitions are saved in the Function Registry, a repository where existing Functions can be found, and new Functions can be created. The Function Registry also provides the functionality of testing Functions by providing sample input data, so that you can explore the requirements and the results of a Function before determining whether to integrate them into Workers.
The Lemma platform comes with a set of predefined Functions, including some of the latest models as well as models with special compliance guarantees. These ready-to-use functions do not require you to preconfigure their own authentication schemes.
Functions can be Stochastic, meaning that the output of an API call can be different for the same given inputs (eg LLM’s,) or Deterministic, meaning that the output of an API call will be the same for the same given inputs. Depending on the type of the function, retries may have different behavioral guarantees.


A Connection pulls data from a data source like a Database or an API and executes a Run of a Worker using the incoming data. Each Connection can be configured to pull specific data from a data source at a pre-configured frequency or stream. The data being processed can either be structured, semi-structured, or unstructured.
If the data source is protected and requires authentication credentials, then a Connection can use preconfigured Secrets to access that data.
Key Attributes of a Connection:
Source: API, database, etc where data will be pulled from.
Schema: What data will be pulled from the source. The schema lets you define the specific tables, API resources, etc you would like to pull from your Connection.
Schedule: The frequency at which this Connection will pull data.
Credentials: The Secret, if required, used to access data from the source.
Worker: The Worker that will be executed upon new data being pulled.
Example Types of Connections:
Pull Salesforce case records into a Worker that automatically triages the case.
Sync Google Drive data into a Worker that generates text embeddings.
Sync Shopify Product data into a Worker that powers product recommendations and search.

A Secret stores sensitive information, such as API keys, passwords, and database credentials, used by Functions and Connections. They are managed securely and encrypted within the platform, preventing hardcoding of sensitive data into your Workers.
Lemma comes with a set of Credentials managed by Thread for common AI building blocks pre-configured in the Function Registry. These are available for use by any user on the platform, so that you can experiment, try, and productionize different Functions without signing up for every different cloud or model provider, reducing overhead and lowering barriers to entry for workflow building!
This allows for an easy bootstrapping of new Workers and better experience with experimenting and mixing different Function service providers. Functions available to use with Thread Credentials can be configured on a per-tenant level, adhering to organizational restrictions and practices.
Billing for usage of Thread credentials will be included in monthly usage pricing.

Applications are another interface to Lemma Workers. Applications allow you to continue to work as you do today in your existing tool chain, but access and leverage the power of your Workers easily to enhance and augment from those same tools.
Applications are an easy way to interact with Workers and provide contextual information.
Compliance
CJIS
GDPR
HIPAA
SOC 2 Type 2