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.1.tar.gz (26.4 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.1-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: visus_sdk_runpilot-0.2.1.tar.gz
  • Upload date:
  • Size: 26.4 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.1.tar.gz
Algorithm Hash digest
SHA256 b9c6a54772aae12975265bdebab8bf475a9c2740101044da824ab8d4562faf13
MD5 e3b7782b691662cadbc6e9d07e53ceb7
BLAKE2b-256 8188004ca37558f43d3b637cf7a5528d02397a7dca915cf010ac04a6a66d875f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for visus_sdk_runpilot-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10f1a6346feb2510a5b7de43c9fdcf582b0d6687c4c698731d8df07c0413157d
MD5 e7916d1ae76846861f5219f4abe1e6e7
BLAKE2b-256 b2f9514aa0cdffc3ff5403a9c0c782539e2aad039c15b4f6dfa197deadd5c92b

See more details on using hashes here.

Provenance

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