Workflows
Learn about workflows in Inferable
In Inferable context, workflows provide a powerful “Workflow as Code” approach to orchestrating complex, multi-step AI agent interactions within the platform. Workflows are the bedrock of all AI interactions in Inferable.
Workflow Definition
Workflows are defined in your own codebase and run in your own compute environment. The control plane “discovers” your workflow when you register it, making it callable by any other machine that has access to your Inferable cluster.
Execution ID
When you trigger a workflow, you must specify an executionId
. Inferable will use this executionId
as an idempotency key.
If you trigger the same workflow with the same executionId
, only the first execution will be executed, and the subsequent executions will no-op.
Workflow Context
Every workflow definition receives a context
object. This context object is used to access the Inferable SDK and other services.
For example, you can use the llm
object to interact with an LLM.
Context Services
ctx.llm
- Interacting with LLMsctx.agents
- Interacting with agentsctx.memo
- Memoizing intermediate resultsctx.log
- Logging for workflow observability
Inputs and Outputs
The workflow input is defined when you trigger the workflow. It is passed in as a JSON object.
The workflow output is the output of the workflow. It is returned as a JSON object.
Versioning
Versioning allows you to evolve your workflow over time in a backwards compatible way. Workflow executions are always executed against the latest version of the workflow.
Workflow executions maintain a version affinity. If a workflow version is updated while an execution is in progress, the execution will continue to use the old version until it completes.
When you register a workflow, you can specify a version.
When your workflow evolves, you can register a new version.
Durability
Workflows are durable and fault-tolerant by default. The Inferable control plane automatically keeps track of workflow executions, their health to ensure that they are reliable and resilient.
Fault Tolerance
If a workflow fails due to a network issue or a machine failure, the control plane will automatically retry the workflow on another machine up to 3 times.
By default, the control plane will detect a workflow as stalled if it doesn’t complete within 5 minutes. In which case it will be retried on another machine up to 3 times.
You can customize this behavior by changing the workflow configuration.
Pause and Resume
Workflows can also pause indefinitely and resume later on. This is especially useful if you are waiting for a long running process to complete. In inferable, there are two main ways that a workflow can pause:
- Human in the Loop - The workflow pauses when waiting for human input. More on this on Human in the Loop
- Agentic Pause - The workflow pauses when waiting for an agent loop to complete. More on this on Agents
Was this page helpful?