Version 3
Robot runtime reference

Robot runtime reference

What a robot sees while it runs on Sema4.ai: its run variables, how its library calls are answered, and the limits that apply.

Audience: builders who write robots

Task Engine is in private preview. To get access, contact us (opens in a new tab).

Library calls

The robot libraries talk to Sema4.ai the way they talk to Control Room, so a robot runs without changes:

LibraryWorks with
robocorp.workitems, RPA.Robocorp.WorkItemsThe step's task items and output items
robocorp.vault, RPA.Robocorp.VaultThe workspace's Secrets
robocorp.storageThe workspace's Assets

When Sema4.ai refuses a call, the library gets a 4xx answer whose message names the problem, and the robot logs it as the reason its step failed. A refused call changes nothing. The libraries retry server and network errors on their own, up to five attempts.

Run variables

Each robot run gets the variables Control Room sets, filled from the Workflow:

VariableControl RoomSema4.ai
RC_WORKSPACE_IDThe workspaceThe workspace's ID
RC_PROCESS_IDThe processThe Workflow's ID
RC_PROCESS_NAMEThe process nameThe Workflow's name
RC_PROCESS_RUN_IDThe process runThe work item's run
RC_ACTIVITY_IDThe step's IDThe step's key, such as erp_lookup
RC_ACTIVITY_NAMEThe step nameThe step's label, or the task name
RC_ACTIVITY_RUN_IDThe step runThe robot run's ID
RC_ORGANIZATION_IDThe organizationNot set
RC_PROCESS_RUN_NUMBERThe process's run countNot set
RC_ACTIVITY_RUN_NUMBERThe step run's numberNot set

When an agent starts a robot instead of a step, RC_PROCESS_ID and RC_PROCESS_NAME name the task package, and RC_ACTIVITY_ID names the task.

The step's own variables are set as well. A step can't set a variable whose name starts with RC_.

Check robots that read the run numbers. A robot that builds a file name or a reference from RC_PROCESS_RUN_NUMBER gets no value on Sema4.ai. Use RC_PROCESS_RUN_ID instead, which is unique for every run.

Work items

  • Releasing an item. A robot releases each input item as done or failed. A failure carries a type, BUSINESS or APPLICATION, a code of up to 50 characters, and a message of up to 1,000 characters. They show on the item in Sema4.ai.
  • Items the robot doesn't release. When a run ends while the robot still holds items, they are settled for it: done if the run succeeded, and failed with the type ORCHESTRATOR if the run failed, was stopped, or lost its worker.
  • Output items can be created twice. As on Control Room, the library retries a request whose answer was lost, so a network error can create a second output item with the same data. When duplicates matter, have the next robot check what it has already done.
  • An item keeps its ID. A resumed item and an output item a later step takes keep their IDs, as on Control Room.
  • Files. An item holds one file per name: adding a file under a name the item already has replaces it. Each file can be up to 50 MB.

Secrets

  • A secret is a map of items, such as username and password, read with vault.get_secret("erp_login")["password"].
  • A secret's value is at most 10,000 bytes.
  • Names are case sensitive: erp and ERP are two secrets.
  • A robot may write a secret. The name it writes under can't contain whitespace or /.
  • If a robot changed a secret's value after an admin opened it for editing, the admin's save is refused, so an admin never overwrites a newer value without seeing it.

Assets

  • A robot reads an asset by name: storage.get_text("price_list"), storage.get_json(...), or storage.get_file(...).
  • A robot can write an asset, including larger and binary values. Admins set text and JSON values on the Assets page.

Artifacts

A run's artifacts are the files the worker uploads when the robot ends, such as console.txt, the robot's log, screenshots, and result.json. Each can be up to 50 MB. People open them on the robot run page. A later agent step can't read them, so put what it needs in the output items' data.

Robot runs, their artifacts, and their items are kept for 90 days.