{"id":7681,"library":"robocorp-tasks","title":"Robocorp Tasks","description":"robocorp-tasks is a Python framework designed to simplify the development of Python automations by providing a runner for tasks, offering logging out of the box, and managing the lifecycle for running such tasks. It is currently at version 4.1.1 and receives continuous updates as part of the broader Robocorp/Sema4.ai ecosystem.","status":"active","version":"4.1.1","language":"en","source_language":"en","source_url":"https://github.com/robocorp/robocorp","tags":["rpa","automation","tasks","robocorp","python-framework"],"install":[{"cmd":"pip install robocorp-tasks","lang":"bash","label":"Install robocorp-tasks"},{"cmd":"pip install robocorp","lang":"bash","label":"Install Robocorp metapackage (recommended for full ecosystem)"}],"dependencies":[{"reason":"Leveraged by robocorp-tasks for out-of-the-box logging functionality.","package":"robocorp-log"},{"reason":"Metapackage including core features like Work Items, Vault, and other Control Room integrations; recommended for full framework utilization.","package":"robocorp","optional":true},{"reason":"Commonly used for web automation tasks within the Robocorp ecosystem.","package":"robocorp-browser","optional":true},{"reason":"Used for interacting with Control Room work items in automations.","package":"robocorp-workitems","optional":true}],"imports":[{"note":"Old Robot Framework-centric paths or incorrect top-level imports are common mistakes.","wrong":"from robocorp.robot import task","symbol":"task","correct":"from robocorp.tasks import task"},{"note":"Used for defining setup fixtures for tasks or sessions.","symbol":"setup","correct":"from robocorp.tasks import setup"},{"note":"Used for defining teardown fixtures for tasks or sessions.","symbol":"teardown","correct":"from robocorp.tasks import teardown"}],"quickstart":{"code":"import os\nfrom robocorp.tasks import task\nfrom robocorp import log\n\n@task\ndef hello_robocorp_world():\n    \"\"\"A simple Robocorp task that logs a message.\"\"\"\n    name = os.environ.get('ROBOCORP_USER_NAME', 'World')\n    log.info(f\"Hello, {name} from Robocorp!\")\n    log.critical(\"This is a critical log message.\")\n    log.debug(\"This is a debug message.\")\n\n# To run: Save as tasks.py and execute 'python -m robocorp.tasks run tasks.py'\n# You can also use 'python -m robocorp.tasks run . -t hello_robocorp_world' in a directory.","lang":"python","description":"This quickstart defines a basic Robocorp task using the `@task` decorator. It uses `robocorp.log` for output and demonstrates how to access environment variables. Tasks are executed via the `python -m robocorp.tasks run` command, specifying the file or directory and optionally the task name."},"warnings":[{"fix":"Develop new automations in Python. Convert existing Robot Framework projects to Python where feasible.","message":"The broader Robocorp ecosystem has transitioned focus from Robot Framework to Python. While existing Robot Framework bots continue to operate, all new development and tooling support is directed towards Python. Users should plan to migrate or develop new automations in Python.","severity":"breaking","affected_versions":"All versions post-February 2024 (LTS for Enterprise until Feb 2025)"},{"fix":"Uninstall 'Robocorp Code' extension from VS Code and install 'Sema4.ai Extension'.","message":"The `Robocorp Code` VS Code extension has been deprecated and replaced by the `Sema4.ai extension`. Users should uninstall the old extension and install the new one for continued support and new features.","severity":"deprecated","affected_versions":"Robocorp Code extension versions prior to Sema4.ai extension release"},{"fix":"Always consult the changelog (e.g., on PyPI or GitHub) when upgrading to a new major version to understand breaking changes and migration steps.","message":"Robocorp libraries with versions `0.x.x` are considered in development and may introduce breaking changes on any update. Although `robocorp-tasks` is now `4.x.x`, developers should always check the changelog for major version updates (`X.0.0`) for specific migration guidance as per SemVer.","severity":"gotcha","affected_versions":"All major version increments (e.g., 3.x.x to 4.x.x)"},{"fix":"Only import and use symbols directly exposed under the `robocorp.<library>` namespace (e.g., `robocorp.tasks.task`), avoiding any `_` prefixed modules or functions.","message":"Modules and functions within the Robocorp libraries that start with an underscore (`_`) are considered internal and are not part of the public API. Importing or relying on these can lead to unexpected behavior or breaking changes in minor updates.","severity":"gotcha","affected_versions":"All versions"},{"fix":"When running tasks, either ensure only one `@task` decorated function exists in the target file/directory, or explicitly specify the task to run using the `-t <task_name>` argument: `python -m robocorp.tasks run my_tasks.py -t my_specific_task`.","message":"In current versions, the `python -m robocorp.tasks run` command is designed to execute only one task per invocation. If multiple tasks are found in the target script/directory without a specific task name (`-t`) being provided, an error will be raised.","severity":"gotcha","affected_versions":"All versions (as of 4.1.1)"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Disable the Windows Group Policy 'User Account Control: Behavior of the elevation prompt for standard users' and 'Windows Customer Experience Improvement Program' settings. Refer to Robocorp documentation for specific policy paths.","cause":"This error can occur if the Windows Customer Experience Improvement Program interferes with desktop sessions, causing unexpected logoffs during automation.","error":"Error: \"Sending logoff command to the desktop session\""},{"fix":"Ensure your Windows system's code page is set to Unicode. Check Robocorp's troubleshooting guide for detailed steps on adjusting locale settings.","cause":"Often related to Windows code page settings not being configured for Unicode, leading to character encoding issues.","error":"UnicodeEncodeError or garbled characters in logs/output"},{"fix":"Clear or clean up local environment caches using the `rcc` command-line tool. Consult RCC documentation for specific cache clearing commands.","cause":"This typically indicates an issue during the creation or setup of the Python execution environment by RCC (Robocorp Command Center), possibly due to a stuck process or cache corruption.","error":"Encountering a PID lock in environment building"},{"fix":"Only import symbols that are part of the documented public API. Avoid importing any modules or functions that begin with an underscore (`_`).","cause":"Attempting to import internal modules or functions that are not part of the public API (indicated by a leading underscore).","error":"ImportError: cannot import name '_internal_module' from 'robocorp.tasks'"}]}