Version 3
Develop a task package

Develop a task package

Write and test a robot on your own machine, in the Sema4.ai SDK or with an AI coding agent.

Audience: builders who write robots

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

What a task package is

A task package is a robot: a folder of Python code with one or more tasks, and the environment they run in.

  • robot.yaml (or package.yaml) names the tasks and how each one starts.
  • conda.yaml pins the Python version and the libraries, such as robocorp and rpaframework. rcc builds the environment from it on every machine that runs the robot.
  • Your code defines each task, usually with @task from robocorp.tasks (opens in a new tab).

The format is the one Robocorp has always used. See Task package structure (opens in a new tab), the robot.yaml format (opens in a new tab), and environment control (opens in a new tab) in the Robocorp documentation.

Choose how you build

There are two ways to write and test robots. Both produce the same task package.

WayBest for
The Sema4.ai SDK in VS CodeTeams who already build robots with the SDK or Robocorp's tools. Recommended if you have done this before.
An AI coding agent such as Claude Code, Codex, or CursorTeams new to robots, who want an agent to scaffold, write, and test them

Build with the Sema4.ai SDK

Install the Sema4.ai SDK

Install the Sema4.ai SDK (opens in a new tab) from the extension marketplace of VS Code or a compatible editor, such as Cursor or Windsurf. It brings rcc and the robot environments with it.

Download the connection profile

In Sema4.ai, open the account menu and select Access credentials. In Build and test tasks locally, select Download connection profile. The file, rcc-profile-sema4ai.yaml, points the SDK at your Sema4.ai instance.

Import and switch to the profile

In VS Code, run Sema4.ai: Import Profile and choose the file, then run Sema4.ai: Switch Profile and pick it.

Create an access credential

On the same Access credentials page, select New access credential, name it after the machine, for example "Build laptop", and copy the value. You won't see it again after you close the dialog. Give it to the SDK when it asks you to link to your workspace.

An access credential acts as you. Your developer tools use it to publish and read with your access, in every workspace where you can build. Create one per machine or tool, and revoke it on the Access credentials page when you no longer need it.

Build with an AI coding agent

Give your coding agent Robocorp's robocorp-automation skill, and it can start a robot from an empty folder, write its tasks with robocorp.tasks and rcc, run it locally, and check that it really passed.

Add the skill to your agent

In Claude Code, install it as a plugin:

/plugin marketplace add robocorp/robocorp
/plugin install robocorp-automation@robocorp

For Codex, Cursor, and other agents, copy the skill into your automation project:

base=https://raw.githubusercontent.com/robocorp/robocorp/master/skills/robocorp-automation
mkdir -p .agents/skills/robocorp-automation/references
curl -fsSL "$base/SKILL.md" -o .agents/skills/robocorp-automation/SKILL.md
curl -fsSL "$base/references/api.md" -o .agents/skills/robocorp-automation/references/api.md

See the skill in the robocorp repository (opens in a new tab).

Connect the same agent to Sema4.ai

Connect the agent to your workspace through Bring your own builder. With both, one agent can write and test the robot on your machine, then publish it, set up its secrets and assets, and put it into a Workflow. See Build with AI tools.

Describe the robot

For example:

Build a task package that logs in to our supplier portal, downloads this week's invoices, and creates one output work item per invoice. Run it locally and show me the result.

The agent scaffolds the robot from an rcc template, writes the task, and runs it. If rcc isn't installed, it tells you which build matches your machine and asks you to download it. For local runs, it keeps test work items and secrets in the project's devdata folder, never in the code.

Publish it

Ask the agent to build the package and add it to Sema4.ai, or publish it yourself.

Write and run a robot in the SDK

Create a task package from one of the SDK's templates, write your tasks, and run them on your machine.

  • Secrets and assets. While the SDK is linked, a robot you run locally reads the workspace's secrets and assets with your own access, so you test with the same names the workers use. Reading a secret needs builder access.
  • Work items. To test a robot that reads input items, give it local test items as you always have. See robocorp.workitems (opens in a new tab).
  • Locators. Record and test locators for web, Windows, and Java applications with the SDK's inspector. See locators (opens in a new tab).

Libraries

Robots use the same open-source libraries as on Robocorp. Their reference lives in the Robocorp documentation:

LibraryUse it for
robocorp-tasks (opens in a new tab)Declaring tasks and their logging
robocorp-workitems (opens in a new tab)Reading input items, creating output items, and releasing items as done or failed
robocorp-vault (opens in a new tab)Reading and writing secrets
robocorp-storage (opens in a new tab)Reading and writing assets
robocorp-browser (opens in a new tab)Browser automation with Playwright
robocorp-windows (opens in a new tab)Windows desktop applications
RPA Framework (opens in a new tab)Excel, PDF, email, Outlook, SAP, databases, and the other RPA.* libraries

For how these behave on Sema4.ai, including which RC_* variables are set, see the robot runtime reference.

Write robots that behave well in a Workflow

A few habits make a robot easier to run, resume, and combine with other steps:

  • Make each item safe to run again. Resume runs a failed item from the start. Check whether the record exists before you create it, so a second attempt doesn't create a duplicate.
  • Release each item with the right exception type. Use BUSINESS when the data is wrong and a person must fix it, and APPLICATION when the system failed and a retry may work. The type, code, and message show on the item in Sema4.ai.
  • Create output items when an item's work is done. Output items pass to the next step even if their input item fails later.
  • Put what a later step needs in the output's data. A later agent step reads each item's data, but not the files a robot attached.
  • Keep secrets in Secrets. Read logins and keys by name at run time instead of keeping them in the package.

Build the package file

Build the package as a ZIP with the SDK's export command, or with rcc robot wrap from a terminal. Sema4.ai accepts a ZIP that:

  • has robot.yaml or package.yaml at its top level,
  • declares at least one task in its tasks,
  • and is at most 100 MB.

Sema4.ai does not check conda.yaml when you publish. The worker builds the environment the first time it runs the version, so run the robot locally before you publish it.

Then publish it.