Skip to main content

Timestep AI - Durable agent execution framework with DBOS workflows, cross-language state persistence, and multi-model support for OpenAI Agents

Project description

Timestep (Python)

Python bindings for the Timestep Agents SDK. See the root README.md for the full story; this file highlights Python-specific setup.

Install

pip install timestep

Prerequisites (Python)

  • OPENAI_API_KEY
  • PostgreSQL: Set PG_CONNECTION_URI=postgresql://user:pass@host/db

Quick start

from timestep import run_agent, RunStateStore
from agents import Agent, Session

agent = Agent(model="gpt-4.1")
session = Session()
state_store = RunStateStore(agent=agent, session_id=await session._get_session_id())

result = await run_agent(agent, input_items, session, stream=False)

if result.interruptions:
    await state_store.save(result.to_state())

Cross-language resume

Save in Python, load in TypeScript with the same session_id and RunStateStore.load().

Model routing

Use MultiModelProvider if you need OpenAI + Ollama routing:

from timestep import MultiModelProvider, MultiModelProviderMap, OllamaModelProvider

provider_map = MultiModelProviderMap()
provider_map.add_provider("ollama", OllamaModelProvider())
model_provider = MultiModelProvider(provider_map=provider_map)

DBOS Workflows

Timestep supports durable agent execution via DBOS workflows. Run agents in workflows that automatically recover from crashes.

Durable Execution

from timestep import run_agent_workflow, configure_dbos, ensure_dbos_launched
from agents import Agent, OpenAIConversationsSession

configure_dbos()
ensure_dbos_launched()

agent = Agent(model="gpt-4.1")
session = OpenAIConversationsSession()

# Run in a durable workflow
result = await run_agent_workflow(
    agent=agent,
    input_items=input_items,
    session=session,
    stream=False,
    workflow_id="unique-id"
)

Queued Execution

from timestep import queue_agent_workflow

handle = await queue_agent_workflow(
    agent=agent,
    input_items=input_items,
    session=session,
    priority=1,
    deduplication_id="unique-id"
)

result = await handle.get_result()

Scheduled Execution

from timestep import create_scheduled_agent_workflow

await create_scheduled_agent_workflow(
    crontab="0 */6 * * *",  # Every 6 hours
    agent=agent,
    input_items=input_items,
    session=session
)

Package Structure

The Python package is organized into clear modules:

  • core/: Core agent execution functions (run_agent, default_result_processor)
  • core/agent_workflow.py: DBOS workflows for durable agent execution
  • config/: Configuration utilities (dbos_config, app_dir)
  • stores/: Data access layer
    • agent_store/: Agent configuration persistence
    • session_store/: Session data persistence
    • run_state_store/: Run state persistence
    • shared/: Shared database utilities (db_connection, schema)
    • guardrail_registry.py: Guardrail registration
    • tool_registry.py: Tool registration
  • tools/: Agent tools (e.g., web_search)
  • model_providers/: Model provider implementations (OllamaModelProvider, MultiModelProvider)
  • models/: Model implementations (OllamaModel)

Documentation

Full docs: https://timestep-ai.github.io/timestep/

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

timestep-2026.0.49.tar.gz (396.4 kB view details)

Uploaded Source

Built Distribution

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

timestep-2026.0.49-py3-none-any.whl (339.2 kB view details)

Uploaded Python 3

File details

Details for the file timestep-2026.0.49.tar.gz.

File metadata

  • Download URL: timestep-2026.0.49.tar.gz
  • Upload date:
  • Size: 396.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for timestep-2026.0.49.tar.gz
Algorithm Hash digest
SHA256 233f01a4722fdf5766c8f1469ff9e89c5dfd9f5de54653766310213a3897b61e
MD5 46c56bc712e80e0371cc882a4d6952f9
BLAKE2b-256 a817903d88dea69c9ae97ac1e127de9ceb4975bc92ee823f72b31fcc0a931055

See more details on using hashes here.

File details

Details for the file timestep-2026.0.49-py3-none-any.whl.

File metadata

  • Download URL: timestep-2026.0.49-py3-none-any.whl
  • Upload date:
  • Size: 339.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for timestep-2026.0.49-py3-none-any.whl
Algorithm Hash digest
SHA256 0c93340b7d7cdb9fa3989ab91e7f113ce53a6b26d0a1e068d68c2e8f7a2b564d
MD5 8c6a9a6e0d3e101270f9f9af3a623d7e
BLAKE2b-256 7b2ef20fc5b34f627b067da357e057bad65527f826b30a9e96d3dd1a6ce9c4de

See more details on using hashes here.

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