Quick Start
You are going to build a four-instrument lab and run a plate through it. The lab is a folder of files, called a deployment package. The Orca daemon builds the folder and runs its workflow. Everything runs as a check run on your laptop, so no hardware is involved.
A plate comes out of the stacker, gets shaken, gets sealed, and goes to waste. One robotic arm carries it between the instruments.
stacker -> shaker -> sealer -> waste
dispense shake seal discard
a robotic arm moves the plate between them
Before you start
You should have Orca Framework installed (see Installation) and the virtual environment active, so the orca command is on your path.
The package folder
Make a folder called my_lab with these four files:
my_lab/
topology.py
workflows/
my_first_workflow.py
teachpoints/
robotic_arm.json
access_configs.json
No __init__.py is needed.
topology.py
from orca.sdk.build import Topology
from orca.sdk.devices import Sealer, Shaker, Storage, Transporter, Waste
SYSTEM_NAME = "My First Lab"
def build_topology() -> Topology:
return Topology(
locations={
"stacker": Storage("stacker"),
"shaker": Shaker("shaker"),
"sealer": Sealer("sealer"),
"waste": Waste("waste"),
},
transporters=[Transporter("robotic_arm")],
)
workflows/my_first_workflow.py
Name the file after the workflow it holds.
import orca.orca as orca
from orca.sdk.build import Topology
from orca.sdk.devices import Sealer, Shaker
from orca.sdk.labware import PlateTemplate
from orca.sdk.workflow import DISPENSE, ActionContext, MethodContext, ThreadContext, WorkflowContext
# 1. Labware template
sample_plate = PlateTemplate("sample_plate", "Cor_Falcon_96_wellplate_340ul_Fb_Black")
def build_workflow(topology: Topology):
shaker = topology.device("shaker", Shaker)
sealer = topology.device("sealer", Sealer)
# 2. Actions: one step at one device
@orca.action(device=shaker, inputs=[sample_plate])
async def shake(ctx: ActionContext):
await ctx.device().shake(duration=30, speed=500)
@orca.action(device=sealer, inputs=[sample_plate])
async def seal(ctx: ActionContext):
await ctx.device().seal(temperature=100, duration=60)
# 3. Methods: sequences of actions
@orca.method
async def shake_step(ctx: MethodContext):
yield shake
@orca.method
async def seal_step(ctx: MethodContext):
yield seal
# 4. Labware thread: one plate's path through the lab
@orca.thread(labware=sample_plate, start=("stacker", DISPENSE), end="waste")
async def sample_thread(ctx: ThreadContext):
yield shake_step
yield seal_step
# 5. Workflow: starts the threads
@orca.workflow(name="my_first_workflow")
def my_workflow(wf: WorkflowContext):
wf.start(sample_thread)
return my_workflow
teachpoints/robotic_arm.json
One file per transporter, named after it. Each key is a position the arm can reach.
{
"stacker": {
"access": "default_vertical",
"cartesian": {"x": 0.0, "y": 200.0, "z": 300.0, "yaw": 0.0, "pitch": 90.0, "roll": 180.0},
"orientation": "right"
},
"shaker": {
"access": "default_vertical",
"cartesian": {"x": 400.0, "y": 200.0, "z": 300.0, "yaw": 0.0, "pitch": 90.0, "roll": 180.0},
"orientation": "right"
},
"sealer": {
"access": "default_vertical",
"cartesian": {"x": 800.0, "y": 200.0, "z": 300.0, "yaw": 0.0, "pitch": 90.0, "roll": 180.0},
"orientation": "right"
},
"waste": {
"access": "default_vertical",
"cartesian": {"x": 1200.0, "y": 200.0, "z": 200.0, "yaw": 0.0, "pitch": 90.0, "roll": 180.0},
"orientation": "right"
}
}
access_configs.json
Each teachpoint names an access config: how the arm approaches the position.
{
"default_vertical": {
"access_type": "vertical",
"gripper_offset": 20.0,
"horizontal_clearance": 100.0,
"name": "default_vertical",
"vertical_clearance": 20.0
}
}
Run it
Run these from inside my_lab:
orca start
orca topology mount
orca run my_first_workflow --run-mode CHECK_RUN --wait
orca shutdown
The first orca command after an install prints nothing for up to half a minute while Python compiles. It is not hung.
You should see:
daemon started (pid=50440, port=61148). No system loaded -- run `orca topology mount` next.
mounted the package folder; runtime is RUNNING
submitted execution ddaf9fcd (my_first_workflow)
waiting up to 300.0s for completion...
execution ddaf9fcd
workflow: my_first_workflow
status: completed
error:
daemon stopped (pid=50440)
What each command does:
orca startstarts the daemon in the background. Its package folder is the folder you ran it in, orORCA_PACKAGE_DIRwhen that is set.orca topology mountbuildstopology.pyand every file inworkflows/. A build error is printed here.orca runsubmits the workflow. Every run needs--run-mode.--waitholds the command until the run ends and prints its end state.orca shutdownstops the daemon.
Between mount and shutdown you can look around: orca execution list, orca device list, orca labware list, orca events list. orca --help lists every command.
After you edit a file, run orca runtime reload to build it again. It is refused while a run is active.
How the files work
1. The labware template
sample_plate = PlateTemplate("sample_plate", "Cor_Falcon_96_wellplate_340ul_Fb_Black")
A labware template describes a type of plate, not a specific physical plate. The first argument is a name you reference in actions. The second is a labware-catalog key (the PyLabRobot plate definition name) that gives the geometry, well count and dimensions.
Each plate the workflow runs is a separate instance with its own name, minted as <template>-<8 hex chars>, for example sample_plate-a1b2c3d4. That name is what shows up in the records. See Labware.
2. The devices and the topology
The topology is the lab's physical layout. It maps location names to devices. The string "stacker" in the locations dict is the same name a labware thread uses in its start= and end= arguments. The transporters list says which arm can move labware between those locations.
Each device is constructed with a name and nothing else. The topology says what the lab has. It does not say how a device is driven. That is set up per device, outside topology.py (see Beyond the check run).
The topology is separate from any workflow, so one lab can serve many workflows. A third argument, pools, groups interchangeable devices into one pool; this lab has none. See Topology.
3. The arm and its teachpoints
A teachpoint is the coordinate the arm needs to pick or place labware at one position. The numbers in teachpoints/robotic_arm.json are placeholders, which is fine for a check run.
The transporter is the robotic arm. Transporter("robotic_arm") takes only a name. Its teachpoints are the file with the same name. Teachpoints are read on every move, so an edit applies to the next move. On real hardware you record a position with orca teachpoints capture. See Transporters.
4. Actions
@orca.action(device=shaker, inputs=[sample_plate])
async def shake(ctx: ActionContext):
await ctx.device().shake(duration=30, speed=500)
An action runs at one device, with one or more pieces of labware as input. Its body issues one or more operations, here a single shake call. ctx.device() gives you a typed handle to the device. See Actions.
5. Methods
@orca.method
async def shake_step(ctx: MethodContext):
yield shake
A method groups actions into a named, reusable sequence. A method can also be run on its own. See Methods.
6. The labware thread
@orca.thread(labware=sample_plate, start=("stacker", DISPENSE), end="waste")
async def sample_thread(ctx: ThreadContext):
yield shake_step
yield seal_step
A labware thread is the path one piece of labware takes through the system. It declares which template it tracks, where the labware starts, where it ends, and the methods to run along the way.
start and end also say how the labware arrives and leaves. DISPENSE means the stacker dispenses the next plate itself, which is why start is a tuple here. A bare string end, like end="waste", means an operator takes the plate away. A check run does that for you. The other ways in and out are in Threads.
Threads run in parallel. A second one for tip racks moving through the same lab would run alongside this one.
7. The workflow
@orca.workflow(name="my_first_workflow")
def my_workflow(wf: WorkflowContext):
wf.start(sample_thread)
A workflow ties threads together. wf.start(...) declares which thread starts when the workflow runs. For a multi-thread workflow you add wf.thread(other_thread) for the secondary threads.
The workflow function is a regular def, not async def. It declares structure. It does not run anything. See Workflows.
8. build_workflow
The daemon calls build_workflow(topology) in each file under workflows/ with the topology it built, and registers the workflow the function returns. topology.device("shaker", Shaker) looks a device up by name and checks its kind.
Where the run's state is
The daemon keeps plates, runs, incidents and events in my_lab/.orca/state.db. They survive a restart. A check run is the exception: it works on a copy of the plate record and writes nothing back, so you can repeat it as often as you like.
To start clean, stop the daemon and delete .orca/. See Where state lives.
Drive it from Python
A script talks to the running daemon through the Python client. Start the daemon on a fixed port (orca start --port 8765) so the script knows where it is:
import time
from orca.sdk.client import DaemonLoadingClient
client = DaemonLoadingClient("http://127.0.0.1:8765")
client.mount_package()
run = client.submit_workflow("my_first_workflow", run_mode="CHECK_RUN")
while (detail := client.get_execution(run.id)).status not in ("completed", "partial_completed", "failed", "aborted"):
time.sleep(1)
print(detail.status, detail.error)
Beyond the check run
There are three run modes. See Run modes for the detail.
CHECK_RUNruns every device's simulator inside Orca. It needs nothing else running and does not wait for step times. Use it to check that a workflow builds and runs to the end.SIMruns every device's simulator on an orca-client, paced like the real lab but faster.LIVEdrives each device as it is set up: the real instrument, or its simulator.
SIM and LIVE need an orca-client running and connected. Without one the run is refused:
error: devices_not_ready: The run was not started because these devices are not ready.
stacker: its orca-client is not connected; ...
Connect devices shows how to start orca-client and how to set up each device.