Skip to main content

In-process Python SDK for the RunPilot RPA orchestrator (the client bots use to talk back to the server).

Project description

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.

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.

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

visus_sdk_runpilot-0.2.0.tar.gz (26.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

visus_sdk_runpilot-0.2.0-py3-none-any.whl (21.9 kB view details)

Uploaded Python 3

File details

Details for the file visus_sdk_runpilot-0.2.0.tar.gz.

File metadata

  • Download URL: visus_sdk_runpilot-0.2.0.tar.gz
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for visus_sdk_runpilot-0.2.0.tar.gz
Algorithm Hash digest
SHA256 348d64c5262333ccb8abca015c0a5eab7c56fe8ec047d7570e5a54aaf5674908
MD5 c2a6e4b894d60f411b99785f6d4b16a3
BLAKE2b-256 b6c5e688ce0a1d9e816b982df0aacc6c75f4f9ff4d3823d4e8fe9d55a453ea76

See more details on using hashes here.

Provenance

The following attestation bundles were made for visus_sdk_runpilot-0.2.0.tar.gz:

Publisher: publish.yml on botvisus/visus-sdk-runpilot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file visus_sdk_runpilot-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for visus_sdk_runpilot-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9580f1d0ebfa650d5022f9d04e369c927879e74e0bb97192120e45cdffc764af
MD5 f218aba1b7e74ccca95ed701522f1987
BLAKE2b-256 ac9405a54df753f0bf63879cf9810f5b0da09f0b65d506906575ced3087640c1

See more details on using hashes here.

Provenance

The following attestation bundles were made for visus_sdk_runpilot-0.2.0-py3-none-any.whl:

Publisher: publish.yml on botvisus/visus-sdk-runpilot

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page