Skip to main content

Temporal-native runtime for persistent agents with durable inboxes, governed tools, and replay

Project description

Actant

Actant is a durable Python agent runtime built on Temporal. Define agents and tools normally; Actant handles parallel tools, human approval, deferred work, subagents, suspension, and crash-safe continuation.

Actant is pre-1.0. Public APIs may change.

Why Actant

Agent tools become a distributed-systems problem when calls run in parallel, wait for people, or outlive a worker. Actant handles that orchestration:

  • allowed tools execute concurrently;
  • deferred tools pause without holding a worker;
  • the next model turn waits for the complete tool group;
  • approvals and nested-agent waits surface through the same API;
  • Temporal recovers execution after process or worker failure;
  • projection stores keep state easy for APIs and UIs to read.
flowchart TB
    Turn["One agent turn emits A, B, and C"]
    A["A: execute → completed"]
    B["B: wait ··· human approves → completed"]
    C["C: execute → completed"]
    Barrier["Durable tool-group barrier"]
    Next["Next agent turn"]

    Turn --> A & B & C
    A --> Barrier
    B --> Barrier
    C --> Barrier
    Barrier --> Next

Read Why Actant? for the detailed guarantees and framework comparison.

Install

pip install actant
pip install "actant[openai]"     # optional provider
pip install "actant[anthropic]"  # optional provider
pip install "actant[gemini]"     # optional provider

Start a local Temporal development server:

actant server start --detach

Quickstart

This complete example streams tokens and then prints the persisted final response:

import asyncio
from contextlib import suppress
from uuid import uuid4

from actant import AgentDefinition
from actant.llm.messages import Message
from actant.llm.providers.fake import FakeLLM, FakeResponse
from actant.runtime import AgentRuntime, TemporalRuntimeConfig, TemporalRuntimeWorker
from actant.runtime.events import AgentThreadHooks, StreamListener
from actant.runtime.stores import InMemoryRuntimeStores
from actant.tools import ToolRegistry

responses: asyncio.Queue[Message | Exception] = asyncio.Queue()
stores = InMemoryRuntimeStores()
config = TemporalRuntimeConfig(address="localhost:7233")


class Hooks(AgentThreadHooks):
    async def on_assistant_message(self, message: Message) -> None:
        if not message.tool_calls:
            await responses.put(message)

    async def on_error(self, error: Exception) -> None:
        await responses.put(error)


class Stream(StreamListener):
    async def on_text_delta(self, delta: str) -> None:
        print(delta, end="", flush=True)


agent = AgentDefinition(
    id="assistant",
    name="Assistant",
    persona="You are a useful assistant.",
    llm=FakeLLM(
        [
            FakeResponse(
                text="Hello from Actant.",
                text_chunks=["Hello ", "from ", "Actant."],
            )
        ]
    ),
    tools=ToolRegistry([]),
)
agents = {agent.id: agent}

runtime = AgentRuntime(stores=stores, agents=agents, temporal=config)
worker = TemporalRuntimeWorker(
    stores=stores,
    agents=agents,
    config=config,
    hooks_factory=lambda _thread: Hooks(),
    listener_factory=lambda _thread: Stream(),
)


async def main() -> None:
    worker_task = asyncio.create_task(worker.run())
    try:
        print("Streaming: ", end="", flush=True)
        await runtime.send_message(agent.id, uuid4().hex, "hello")
        response = await asyncio.wait_for(responses.get(), timeout=60)
        if isinstance(response, Exception):
            raise response
        print(f"\nFinal: {response.content}")
    finally:
        worker_task.cancel()
        with suppress(asyncio.CancelledError):
            await worker_task


asyncio.run(main())

# Streaming: Hello from Actant.
# Final: Hello from Actant.

send_message() durably submits work and returns immediately. StreamListener receives live deltas, hooks receive persisted lifecycle events, and the message store provides durable reload.

Use OpenAIProvider, AnthropicProvider, GeminiProvider, or QwenProvider in place of FakeLLM. Actant never chooses a model ID for you.

Demo

The included FastAPI + React viewer demonstrates streaming, approvals, multiple-choice questions, mixed parallel tools, and nested subagents without an API key:

just demo-sync
just demo

Open http://localhost:5173.

Documentation

Development

just sync
just test
just lint
just typecheck
just package

The justfile is repository-only. Installed users receive the actant CLI; run actant server --help for local Temporal commands.

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

actant-0.2.0.tar.gz (110.3 kB view details)

Uploaded Source

Built Distribution

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

actant-0.2.0-py3-none-any.whl (90.7 kB view details)

Uploaded Python 3

File details

Details for the file actant-0.2.0.tar.gz.

File metadata

  • Download URL: actant-0.2.0.tar.gz
  • Upload date:
  • Size: 110.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for actant-0.2.0.tar.gz
Algorithm Hash digest
SHA256 652ad2e77e3164a8b69e1153c274b0a82a6e3c48b1fef6561189d258fde0a41e
MD5 dae23ec8833798344b58b612cda77b24
BLAKE2b-256 3a264f69f0582a2b73d947ea1213a4050e46d8cbdda86baedd5c220d0980f0b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for actant-0.2.0.tar.gz:

Publisher: release.yml on johnathanchiu/actant

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file actant-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: actant-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 90.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for actant-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d796ad81d284ff5dd6ea65eb0549c9221f9a4b58b7f2e9762619bcfaf826e205
MD5 33b464348d341b732b77b1f734641a63
BLAKE2b-256 5ca0f98883323202dd6dd5919fed283b3abe84ccd28751d85fd7fde7a7fdfb85

See more details on using hashes here.

Provenance

The following attestation bundles were made for actant-0.2.0-py3-none-any.whl:

Publisher: release.yml on johnathanchiu/actant

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