Skip to main content

smooai-smooth-operator-temporal (Python)

Optional Temporal durable-execution backend for the smooai-smooth-operator-core Python agent engine (ADR-030). The Python sibling of the smooai-smooth-operator-temporal Rust crate.

An agent turn runs as a Temporal workflow whose side-effects — the model call and each tool invocation — are Temporal activities. The workflow drives the engine's deterministic drive_turn orchestration unchanged, so the durable path and the in-process path are the same loop. That buys crash-safe resume, durable human-in-the-loop, and durable timers without a second implementation of the agent loop to keep in sync.

Optionality

The serde DTO boundary (smooth_operator_temporal.dto) imports no Temporal SDK and is always available. The workflow/activity wiring (smooth_operator_temporal.temporal) imports temporalio, provided by the optional temporal extra — mirroring the Rust crate's off-by-default temporal cargo feature:

pip install 'smooai-smooth-operator-temporal[temporal]'

What it gives you

  • Crash-safe resume — the workflow's event history is the checkpoint, so a worker restart mid-turn resumes rather than restarting the turn.
  • Durable human-in-the-loop — a tool named in approval_required_tools blocks on workflow.wait_condition until an approve_tool / deny_tool signal names its call id. The pending decision lives in workflow history, so it survives a disconnected client and can resolve hours later. A denial returns a tool-error result to the model without ever executing the tool.
  • Durable timers — a call to the configured wait_tool sleeps the workflow on a Temporal timer, a pause that can span days.

Usage

Register the workflow and activities on a worker, injecting the engine handles the activities run against:

from temporalio.client import Client
from temporalio.worker import Worker
from smooth_operator_temporal.temporal import AgentTurnActivities, AgentTurnWorkflow, HealthWorkflow

activities = AgentTurnActivities.from_engine(my_llm_provider)  # AgentOptions optional
client = await Client.connect("localhost:7233")
worker = Worker(
    client,
    task_queue="smooth-operator-agent-turn",
    workflows=[AgentTurnWorkflow, HealthWorkflow],
    activities=[activities.health_echo, activities.model_call, activities.tool_invoke],
)

Start a turn:

from smooth_operator_temporal.dto import AgentTurnInput

messages = await client.execute_workflow(
    AgentTurnWorkflow.run,
    AgentTurnInput(system_prompt="You are a test agent", user_message="what is the durable answer?"),
    id="agent-turn-1",
    task_queue="smooth-operator-agent-turn",
)

Unlike the Rust reference — whose activities are free functions fed by a process-global init_engine — Python holds the engine handles on the AgentTurnActivities instance (plain dependency injection).

Status

The durable backend (workflow + activities + durable timer + HITL signals) is implemented and covered by skip-gated e2e tests. Adapting it behind the engine's streaming AgentExecutor protocol — so a server can select it per turn — is deferred for the same reason the Rust server defers it: a workflow-backed turn has no token-delta stream to feed the runner's event translator. The server-side selection seam (env-gated, injected) lands separately in the smooth-operator server repo.

License

MIT

Download files

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

Source Distribution

smooai_smooth_operator_temporal-1.13.6.tar.gz (39.0 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file smooai_smooth_operator_temporal-1.13.6.tar.gz.

File metadata

  • Download URL: smooai_smooth_operator_temporal-1.13.6.tar.gz
  • Upload date:
  • Size: 39.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for smooai_smooth_operator_temporal-1.13.6.tar.gz
Algorithm Hash digest
SHA256 ffc07ffc5d2dfc3ec31e2b68253c5c9cb503ffdcebe95b72973fc452a0757691
MD5 a6eea3bd86a4c245f34ca6d04622545d
BLAKE2b-256 fc83a6a7dacf2e59484d622d485c529d494319087f02a94a3f22f2deaae3b93e

See more details on using hashes here.

File details

Details for the file smooai_smooth_operator_temporal-1.13.6-py3-none-any.whl.

File metadata

  • Download URL: smooai_smooth_operator_temporal-1.13.6-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.2 {"installer":{"name":"uv","version":"0.12.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for smooai_smooth_operator_temporal-1.13.6-py3-none-any.whl
Algorithm Hash digest
SHA256 66cb646c84de8193a787c6d9cb8ebb066d613016b00ed4fb32aafecf7593f028
MD5 28d5b4801272d42dd6d12f39b8182d10
BLAKE2b-256 114c5155d405ff826d490b5f85f29940006b5ab916e5f062a0b563bbd2ed1fcc

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.13.6 This release

2 files

1.13.5

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page