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.1.0.tar.gz (20.7 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.1.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: visus_sdk_runpilot-0.1.0.tar.gz
  • Upload date:
  • Size: 20.7 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.1.0.tar.gz
Algorithm Hash digest
SHA256 f9a4396d8a6c900c8855aa36414a364b8615f8232a72894479de92e808efc1d2
MD5 483ff28aa13116aad16571fe382bcdb7
BLAKE2b-256 5243e8dfaf966e1119cd546ba501190ec812a2688e2c595c631a3b785a0f0bb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for visus_sdk_runpilot-0.1.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.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for visus_sdk_runpilot-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1717ecb3cb71e052cffbe1526bdb9ba4b8e79a3edc6eed46728a07c9742baad7
MD5 03eee6c3e0a0bd4635e9da204664e8b8
BLAKE2b-256 51c8bcbacb2e7e8f398c61048910c36e4e5cd97c170ac1264ea76257515e47e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for visus_sdk_runpilot-0.1.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