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.5.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.5.tar.gz.

File metadata

  • Download URL: smooai_smooth_operator_temporal-1.13.5.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.5.tar.gz
Algorithm Hash digest
SHA256 fdc3594dc71ad38685e1e0b3dfee74d463741f5b2c9c89f404cfe711a74a494f
MD5 ab79d744ca77b55d31776b2a790dd462
BLAKE2b-256 5688e55db4f610caec16ffebee25738de1c0311ac09d0a44a04d93b7d8963f59

See more details on using hashes here.

File details

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

File metadata

  • Download URL: smooai_smooth_operator_temporal-1.13.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4ccf673fa0cd9dda01935508ac3e3c756b35ab1cfe37da79d0ac8b25c0fa4a2f
MD5 4d1038dac77780af0b6e6a3fb2510f1c
BLAKE2b-256 f34d85f8b32082f82dcc48d1d640bdcb098ec45a807cedc03beb19068295a142

See more details on using hashes here.

Release history Release notifications | RSS feed

1.13.6

2 files

This release

1.13.5 This release

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