This release is a pre-release and may not be stable for production use.
requence
The official Python SDK for the Requence platform. It covers both halves of the integration:
requence.service— connect a Python service to Requence and process messagesrequence.task— start and monitor Requence tasks programmatically
This README is a getting-started guide. The reference for both halves lives at https://docs.requence.cloud — every page has a Python tab, including the places where Python's answer differs from TypeScript's.
Requirements
Python 3.12 or later.
Installation
pip install requence
Authentication
Copy a service's access token from the Services list view in the Requence UI (Copy credentials). A task needs a personal or scoped access token instead.
Tokens are resolved in this order:
access_tokenpassed toService()/Task()REQUENCE_SERVICE_ACCESS_TOKEN/REQUENCE_TASK_ACCESS_TOKEN, thenREQUENCE_ACCESS_TOKENrequence.service_access_token/requence.task_access_token, thenrequence.access_tokeninpyproject.toml
REQUENCE_SERVICE_ACCESS_TOKEN=your-token python main.py
Your first service
Create the service in the Requence UI first — its input schema, configuration schema and outputs. Then implement the version:
from requence.service import Service
def handler(ctx):
return {"message": f"Hello, {ctx.input['name']}!"}
Service("1.0.0", handler)
Service(...)never returns. It consumes on the calling thread, so there is no instance to callact()orclose()on. UseService.start(...)when you need either — it returns the instance once connected, on a daemon consume thread. See Starting & Stopping.
Generate type stubs for ctx.input, ctx.configuration and ctx.to_output() from the schemas
you defined in the UI:
requence-service generate-types
Your first task
from requence.task import Task
task = Task(task_template="my-template", input={"name": "World"})
result = task.sync.result # blocks until the task completes
print(result["result"])
task.sync holds the blocking accessors; await task.result and async for update in task.updates are the async equivalents.
Where to read next
Writing a service
| Topic | Page |
|---|---|
| The full walkthrough | Getting Started |
ctx.input, ctx.debug, retry, abort, skip, to_output, defer |
Context API |
prefetch, ssl_context, TLS via environment |
Service Options |
Service(...) vs Service.start(...), close() |
Starting & Stopping |
Generator handlers and ctx.terminated |
Continuous Mode |
ctx.store — what a node remembers past this message |
The Store · ctx.store |
create_durable_callback, .for_(…) |
Callbacks |
create_ui, ctx.render, handler props |
Surfaces |
ctx.defer() → service.act() |
Deferred Delivery |
| Running locally against real tasks | Dev Overlay |
requence-service generate-types |
Typing / CLI |
Starting tasks
| Topic | Page |
|---|---|
Options, task.sync, abort, protect, require_ack |
Starting Tasks |
| Sync and async iteration, the update types | Streaming Updates |
TaskWatcher across every task |
Watching Tasks |
get_task |
Fetching & Recreating |
requence-task generate-types |
CLI |
test/demo-service/surface_demo.py and test/demo-python/ in the Requence repository are
runnable examples.
Metadata
Release files for requence 0.8.1.dev72
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 |
|---|---|---|---|---|
| requence-0.8.1.dev72.tar.gz | 118.4 kB | Without provenance | Details for requence-0.8.1.dev72.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| requence-0.8.1.dev72-py3-none-any.whl | Python 3 | none | any | Details for requence-0.8.1.dev72-py3-none-any.whl |
Total release size: 246.4 kB
Release files / requence-0.8.1.dev72.tar.gz
| Download URL | requence-0.8.1.dev72.tar.gz |
|---|---|
| Size | 118.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3f96270e91c31b76715578dc62e2317d3a15d60e8333311b965510643546fad8
|
|
BLAKE2b-256 checksum How to use checksums |
41ad6e23523d065bfdc81e33725f4e39559131cc1f14a32585eceb593b0a7408
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / requence-0.8.1.dev72-py3-none-any.whl
| Download URL | requence-0.8.1.dev72-py3-none-any.whl |
|---|---|
| Size | 128.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d1c51ec786110a605b688df8b41033b8fabdd79d4868f5d3400a8ab9d414d280
|
|
BLAKE2b-256 checksum How to use checksums |
f2b76b6f22274612058d1f6c4549eeb28be484e967aab3d30b0adc6d9eaa40d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Security for requence 0.8.1.dev72
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A 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.