runpilot — Python SDK
In-process Python SDK for the RunPilot RPA orchestrator. This is the library your bot imports to talk back to the RunPilot server from inside a run: report progress, stream logs, fetch credentials, upload artifacts, poll interrupt/kill signals and pull DataPool items.
Think of it as the runtime bridge between an RPA script and the orchestrator that
scheduled it. The runner injects the connection details as environment variables;
the SDK reads them and gives you a single Orchestrator object.
Installation
pip install runpilot
Requires Python 3.9+. The only runtime dependency is requests (2.32.3+).
Quick start
Inside a run, build the client from the environment the runner injected:
from runpilot import Orchestrator
bot = Orchestrator.from_env() # reads RUNPILOT_SERVER + run token / api key
ctx = bot.get_run() # the run + task context
bot.report_progress(10, "starting")
api_key = bot.get_credential("stripe", "SECRET_KEY")
pool = bot.datapool("invoices") # claim-and-report DataPool items
while (item := pool.next_item()) is not None:
process(item.data)
item.report_done() # or item.report_error(business=True, message=...)
art = bot.upload_artifact("out/report.pdf")
signals = bot.get_signals() # cooperative interrupt / kill
if signals.kill_requested or signals.interrupt_requested:
bot.finish("failure", "interrupted")
raise SystemExit(0)
bot.finish("success", "processed 42 rows") # canonical: success | failure
Environment variables
Orchestrator.from_env() reads:
| Variable | Purpose |
|---|---|
RUNPILOT_SERVER |
Base URL of the orchestrator (no path), e.g. https://api.runpilot.dev |
RUNPILOT_RUN_TOKEN |
Per-run token (RUN_TOKEN mode — the in-run path) |
RUNPILOT_RUN_ID |
Run ID that accompanies the run token |
RUNPILOT_API_KEY |
Organization API key (management mode) |
RUN_TOKEN mode is what you get inside a run; the in-run methods
(report_progress, get_credential, datapool, upload_artifact, finish, …)
require it.
Security and reliability
- https only. The token goes in the
Authorizationheader, soRUNPILOT_SERVERmust behttps://…. Plainhttpis accepted only for this computer (localhost,127.0.0.1,::1) — orhost.docker.internalwithRUNPILOT_DEV=1, which is how a runner machine reaches a local orchestrator in development. - Credentials never come back. Every value revealed by
get_credential()is replaced by***in everything the SDK sends — logs, errors and tracebacks, steps, alerts and progress. (Values shorter than 4 characters are not masked.) - Network blips don't kill the bot. Reads (GET) are retried on connection errors, timeouts and 502/503/504 (3 attempts, waiting 0.5 s and 1.5 s). Writes (POST) are retried only when the request surely never reached the server (the connection never opened, or 503) — so a slow answer never duplicates a step, log, alert or DataPool report. Real errors (4xx) are not retried, and neither is claiming a DataPool item.
- Plain http on a trusted local network needs an explicit
RUNPILOT_ALLOW_HTTP=1. best_effort=Truemakeslog(),report_progress(),alert()andstep()only warn on a failure (and, after a network failure, skip reporting for 30 s instead of waiting on every call), so a reporting problem never stops the automation —finish()included:Orchestrator(server, run_token=..., best_effort=True).- Light screenshots. With Pillow installed, step screenshots wider than 1920 px are scaled down and sent as JPEG; one over 20 MB is dropped (the step is still reported).
- Threads. Each thread gets its own HTTP connection.
Testing your bot — fully offline
Orchestrator.mock() returns a client that never performs a network request.
Every in-run call is recorded on .calls and returns a sensible canned value, so
you can unit-test a bot without a live server:
from runpilot import Orchestrator
bot = Orchestrator.mock(
run={"run": {"id": "run_1"}, "task": {"name": "demo"}},
credentials={("stripe", "SECRET_KEY"): "sk_test_123"},
datapool={"invoices": [{"id": "inv_1", "data": {"amount": 10}}]},
)
bot.report_progress(50, "halfway")
assert bot.get_credential("stripe", "SECRET_KEY") == "sk_test_123"
assert bot.calls[-1]["method"] == "get_credential"
API surface
from runpilot import ...
| Export | What it is |
|---|---|
Orchestrator |
The client. from_env(), mock(), get_run(), report_progress(), log(), get_credential(), upload_artifact(), get_signals(), datapool(), finish() |
DataPool, DataPoolItem |
Claim-and-report work queue; pool.next_item(), then item.report_done() / item.report_error() |
Run, RunContext, Task, Artifact, Signals |
Typed models returned by the client |
RunPilotError and subclasses |
ConfigurationError, AuthModeError, AuthenticationError, NotFoundError, ApiError, RunAlreadyFinishedError, RunTerminalError |
License
MIT
Metadata
Release files for visus-sdk-runpilot 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| visus_sdk_runpilot-0.2.2.tar.gz | 36.2 kB | With provenance | Details for visus_sdk_runpilot-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| visus_sdk_runpilot-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for visus_sdk_runpilot-0.2.2-py3-none-any.whl |
Total release size: 62.5 kB
Release files / visus_sdk_runpilot-0.2.2.tar.gz
| Download URL | visus_sdk_runpilot-0.2.2.tar.gz |
|---|---|
| Size | 36.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ee11949f866fa6861b067e716ca673d2047d4ec1c189d7628bcf4a4a4df7d9f
|
|
BLAKE2b-256 checksum How to use checksums |
343fa48596e812bd9dffaaf4f93dc9be8e499d29a107f2bde319af61a6b52565
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logRelease files / visus_sdk_runpilot-0.2.2-py3-none-any.whl
| Download URL | visus_sdk_runpilot-0.2.2-py3-none-any.whl |
|---|---|
| Size | 26.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
55250dadf61e21473496cafd1dc495fc42249e3e87de0e0c5be4c09c9b560385
|
|
BLAKE2b-256 checksum How to use checksums |
ad16a678aad19ec84cdb7797bf722104282bcab77bb90d3b36c3bbb7058ae418
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logSecurity for visus-sdk-runpilot 0.2.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for visus_sdk_runpilot-0.2.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.