Evals

DBOS

Test DBOS durable workflows on a simulated clock in Python. A 24-hour durable sleep runs in milliseconds, and its events land in the trajectory.

Status: verified with DBOS 3.7 in Python, on DBOS's default SQLite system database, offline. There is no TypeScript DBOS bridge in 0.1.

DBOS workflows sleep durably: DBOS.sleep_async(24 * 3600) stores its wake-up time and waits. Under trace(clock=clock, patch="timers") both halves follow the simulated clock: the wake-up time is read through time.time() (patched by time-machine, the viewport-evals[clock] extra) and the wait runs on the event loop's patched time. A day passes in milliseconds, and the step that runs after it carries the simulated timestamp.

main.py
DBOS(
    config={"name": "viewport-evals-dbos-example", "system_database_url": f"sqlite:///{tempfile.mkdtemp()}/dbos.sqlite"}
)


@DBOS.step()
async def send_reminder(booking: str) -> str:
    with span({"type": "tool_call", "tool_name": "send_reminder", "args": {"booking": booking}}) as s:
        s.set(result="sent")
    return f"reminded {booking}"


@DBOS.workflow()
async def booking_reminder(booking: str) -> str:
    await DBOS.sleep_async(24 * 3600)  # durable: the wake-up time is stored in DBOS's system database
    return await send_reminder(booking)

main.py
async def test_a_24_hour_durable_sleep_runs_in_milliseconds() -> None:
    clock = simulated_clock("2026-11-25T09:00:00Z")
    started = time.perf_counter()

    async with trace(clock=clock, patch="timers") as t:
        t.output = await booking_reminder("B-1001")

    assert time.perf_counter() - started < 2.0
    assert t.output == "reminded B-1001"
    assert t.calls("send_reminder")[0].started_at == "2026-11-26T09:00:00.000Z"  # 24 simulated hours later

The sync DBOS.sleep works too: with patch="timers", time.sleep called from a worker thread waits on the simulated clock, so a sync workflow run with asyncio.to_thread follows it. On the event loop's own thread time.sleep stays real.

Workflows across episodes

In a multi-episode case, an agent can start a workflow in one episode and the case sees it finish in a later one. Within an episode simulated time stands still, so a durable sleep started there completes on the next advance step (or clock.idle() in code), not inside the episode that started it.

main.py
CASE = """
id: booked-then-reminded
clock: { start: 2026-11-25T09:00:00Z }
allow_empty: true    # no model in this example: the agent starts a workflow and returns
input:
  script:
    - event: { type: payment.succeeded, booking: B-2002 }
    - advance: 24h
expect:
  events:
    - { type: tool_call, where: { tool_name: send_reminder, episode_id: ep_1, started_at: "2026-11-26T09:00:00.000Z" } }
"""


async def agent(case_input: CaseInput) -> str:
    event = case_input.event or {}
    # start_workflow_async keeps the trace's context, so the workflow's sleep and events follow the case. The sync
    # DBOS.start_workflow runs on DBOS's thread pool: its sleeps would run in real time and nothing would be captured.
    await DBOS.start_workflow_async(booking_reminder, event["booking"])
    return "booked"


def test_the_reminder_fires_on_the_advance_episode() -> None:
    report = run_cases(parse_case_file(CASE, "evals/booking.yaml"), config=resolve_config(agent=agent), mode="live")
    assert report["ok"], report["verdicts"]

Start workflows with DBOS.start_workflow_async. The sync DBOS.start_workflow runs the workflow on DBOS's thread pool, which does not inherit the trace's context: its sleeps run in real time and its events are not captured.

Record events from your steps with Viewport Core's span or emit, or call tools that record themselves (core tool, world tools, framework adapters), so the trajectory holds what the workflow did.

On this page