Scan your whole stack
Are you using optio-core?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.11.7
optio-core was last scanned on 1 Dec 2026 at version 0.11.7. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.11.7 LATEST | 1 Dec 2026 | No rules fired |
| 0.11.6 | 1 Dec 2026 | No rules fired |
| 0.11.5 | 30 Nov 2026 | No rules fired |
| 0.11.4 | 30 Nov 2026 | Not shown |
| 0.11.3 | 30 Nov 2026 | Not shown |
Findings for v0.11.7. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.11.7; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
The core Python library for Optio. Embed it in your Python application to define, launch, cancel, and monitor long-running background tasks — with progress reporting, hierarchical child processes, cooperative cancellation, cron scheduling, and ad-hoc dynamic task creation. All backed by MongoDB for persistence. Optional Redis integration enables remote control and custom command handlers.
pip install optio-core
For Redis (clamator RPC) support:
pip install optio-core[redis]
Requirements: Python 3.11+, MongoDB. Dependencies: motor>=3.3.0, apscheduler>=4.0.0a6, mongo-quaestor>=0.1,<0.2, clamator-over-redis>=0.1.9, clamator-protocol>=0.1.9, pydantic>=2.0, aiohttp>=3.9. Redis support: redis>=5.0.0 (optional extra).
import asyncio
from motor.motor_asyncio import AsyncIOMotorClient
from optio_core import init, launch_and_wait, get_process, TaskInstance
async def my_task(ctx):
for i in range(10):
if not ctx.should_continue():
return
ctx.report_progress(i * 10, f"Step {i + 1}/10")
await asyncio.sleep(1)
ctx.report_progress(100, "Done")
async def get_tasks(services, metadata_filter=None):
# Optio filters the result by metadata_filter itself, so it may be ignored.
return [
TaskInstance(
execute=my_task,
process_id="my-task",
name="My Task",
),
]
async def main():
client = AsyncIOMotorClient("mongodb://localhost:27017")
db = client["myapp"]
await init(
mongo_db=db,
get_task_definitions=get_tasks,
)
await launch_and_wait("my-task", session_id=None) # no initiating session
proc = await get_process("my-task")
print(proc["status"]["state"]) # "done"
asyncio.run(main())
All symbols are available directly from optio_core:
import optio_core
init()await optio_core.init(
mongo_db: AsyncIOMotorDatabase,
prefix: str = "optio",
redis_url: str | None = None,
rpc_server: RpcServerCore | None = None,
services: dict[str, Any] | None = None,
get_task_definitions: Callable[..., Awaitable[list[TaskInstance | TaskFactory]]] | None = None,
cancel_grace_seconds: float = 5.0,
auto_resume_delay_seconds: float = 300.0,
cancel_wait_ceiling_margin_seconds: float = 25.0,
shutdown_drain_margin_seconds: float = 5.0,
terminal_poll_interval_seconds: float = 0.1,
force_cancel_shield_seconds: float = 2.0,
app_name: str | None = None,
) -> None
Initialize Optio. Must be called before any other function.
| Parameter | Type | Default | Description |
|---|---|---|---|
mongo_db |
AsyncIOMotorDatabase |
required | Motor async database object |
prefix |
str |
"optio" |
Namespace for collections ({prefix}_processes) and clamator service streams (the {database}/{prefix} Redis key prefix). Override if you need to avoid name collisions in a shared database. Streams are automatically scoped by both database name and prefix, so instances using different databases won't collide even on a shared Redis server. |
redis_url |
str \| None |
None |
If None (and no rpc_server), Redis features are disabled; use direct method calls only. Mutually exclusive with rpc_server |
rpc_server |
RpcServerCore \| None |
None |
A pre-built clamator RPC server to register the optio-engine service on, instead of building one from redis_url. The caller owns its start/stop. Mutually exclusive with redis_url |
services |
dict[str, Any] \| None |
{} |
Passed as ctx.services to all task execute functions |
get_task_definitions |
Callable[..., Awaitable[list[TaskInstance \| TaskFactory]]] \| None |
None |
Async function (services, metadata_filter) -> list[TaskInstance \| TaskFactory]; called on init, when run() starts, and on resync. Optio passes both arguments positionally. metadata_filter is None for a full sync, or a dict of metadata key/value pairs to restrict which task definitions are regenerated; Optio drops the returned tasks that do not match it, so the function may ignore it. This is the most important part — this is where you declare the tasks that Optio will manage. See the TaskInstance and TaskFactory definitions under Data Types. |
cancel_grace_seconds |
float |
5.0 |
How long a cancelled task has to unwind cooperatively before it is force-cancelled and ends failed (see Cooperative Cancellation) |
auto_resume_delay_seconds |
float |
300.0 |
Delay after run() starts before the top-level processes of auto_resume tasks that the previous shutdown interrupted, and that saved their state, are re-launched with resume=True |
cancel_wait_ceiling_margin_seconds |
float |
25.0 |
Added to cancel_grace_seconds to give the ceiling after which Optio.cancel_and_wait() and group_cancel_and_wait() raise asyncio.TimeoutError |
shutdown_drain_margin_seconds |
float |
5.0 |
Added to the grace during shutdown()'s wait for running processes to exit |
terminal_poll_interval_seconds |
float |
0.1 |
Poll interval while waiting for a process to reach a terminal state |
force_cancel_shield_seconds |
float |
2.0 |
How long a force-cancel waits for the task to unwind after Task.cancel() before writing failed anyway |
app_name |
str \| None |
None |
The app's name (e.g. "Excavator"), app-wide: tasks read it as ctx.app_name, and agents' and people's chat profiles default to it (a human admin of the Excavator deployment called "…"). 1-200 characters, no control or bidirectional formatting characters; a bad value fails init() |
The deployment name is configuration, not code: init() reads OPTIO_DEPLOYMENT_NAME from the
environment (trimmed; blank counts as unset; the same rules as app_name, a bad value fails
init()). Tasks read it as ctx.deployment_name. Both are on Optio.app_identity
(AppIdentity(app_name, deployment_name)). Owner, 2026-11-26: "app name is an init parameter,
deployment name is env config".
run()await optio_core.run() -> None
Start the main event loop. Blocks until shutdown() is called. Starts the cron scheduler, the supervisor that force-cancels processes past their cancel grace, the sweep that deletes result files whose process record is gone every 10 minutes (see store_result()), and, if redis_url was given, the clamator RPC server (see Remote Control via Clamator RPC). Once all that runs (definitions synced, the engine chat service started), it launches, once per start, the top-level process of every task with auto_launch (see TaskInstance): with True, fresh, if it has never been launched (its record idle with no launchMode); with "always", unless it is active, resumed when it is resumable (supportsResume and hasSavedState) and fresh otherwise; a refused or failing launch is logged, not raised. Then it arms the auto-resume timer (auto_resume_delay_seconds). Installs signal handlers for SIGTERM and SIGINT that trigger graceful shutdown.
Without Redis, run() simply blocks until shutdown() is called (useful for scheduler-only deployments).
shutdown()await optio_core.shutdown(grace_seconds: float | None = None) -> None
Initiate graceful shutdown. Refuses new launches, stops the RPC server (if Optio built it from redis_url), then sets the cancellation flag of every running process, giving each grace_seconds (default: cancel_grace_seconds) to unwind. It waits up to that grace plus shutdown_drain_margin_seconds for them to exit, then force-cancels every process still running; those end failed. Finally it closes the Redis connection and unblocks run(), which then stops the scheduler.
Every process has a state that follows a strict state machine. The happy path is straightforward:
idle --> scheduled --> running --> done
| |
v v
failed idle (dismiss)
|
v
idle (dismiss)
Cancel path:
scheduled --> cancelled
running --> cancel_requested --> cancelling --> cancelled
cancel_requested / cancelling --> failed (force-cancelled after the grace)
cancelled --> idle (dismiss)
Here is the full state diagram, including re-launch and dismiss transitions:
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.