Skip to content

Commit 17b3c53

Browse files
committed
tweaks from presenting
1 parent 9ad1880 commit 17b3c53

File tree

5 files changed

+33
-32
lines changed

5 files changed

+33
-32
lines changed

durable-exec/deep_research_dbos.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import asyncio
2-
import os
32
import sys
43
import uuid
54
from typing import Annotated, List
@@ -114,7 +113,7 @@ async def deep_research_durable(query: str):
114113
config: DBOSConfig = {
115114
'name': 'deep_research_durable',
116115
'enable_otlp': True,
117-
'conductor_key': os.environ.get('DBOS_CONDUCTOR_KEY', None),
116+
'system_database_url': 'postgresql://postgres@localhost:5432/dbos',
118117
}
119118
DBOS(config=config)
120119
DBOS.launch()

durable-exec/twenty_questions_dbos.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import asyncio
2-
import os
32
import sys
43
import uuid
54
from dataclasses import dataclass
65
from enum import StrEnum
6+
from typing import Any
77

88
import logfire
9-
from dbos import DBOS, DBOSConfig, SetWorkflowID
9+
from dbos import DBOS, DBOSConfig, SetWorkflowID, WorkflowHandle
1010
from pydantic_ai import Agent, AgentRunResult, RunContext, UsageLimits
1111
from pydantic_ai.durable_exec.dbos import DBOSAgent
1212

@@ -78,20 +78,22 @@ async def play(resume_id: str | None, answer: str) -> AgentRunResult[str]:
7878
config: DBOSConfig = {
7979
'name': 'twenty_questions_durable',
8080
'enable_otlp': True,
81-
'conductor_key': os.environ.get('DBOS_CONDUCTOR_KEY', None),
81+
'system_database_url': 'postgresql://postgres@localhost:5432/dbos',
8282
}
8383
DBOS(config=config)
8484
DBOS.launch()
85-
wf_id = f'twenty-questions-{uuid.uuid4()}'
85+
8686
if resume_id is not None:
8787
print('resuming existing workflow', resume_id)
88-
wf_id = resume_id
88+
wf: WorkflowHandle[Any] = DBOS.retrieve_workflow(resume_id)
89+
result = await wf.get_result()
8990
else:
91+
wf_id = f'twenty-questions-{uuid.uuid4()}'
9092
print('starting new workflow', wf_id)
9193

92-
state = GameState(answer=answer)
93-
with SetWorkflowID(wf_id):
94-
result = await dbos_questioner_agent.run('start', deps=state, usage_limits=UsageLimits(request_limit=25))
94+
state = GameState(answer=answer)
95+
with SetWorkflowID(wf_id):
96+
result = await dbos_questioner_agent.run('start', deps=state, usage_limits=UsageLimits(request_limit=25))
9597

9698
print(f'After {len(result.all_messages()) / 2}, the answer is: {result.output}')
9799

durable-exec/twenty_questions_temporal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
# Agent that asks questions to guess the object
3636
questioner_agent = Agent(
37-
'anthropic:claude-sonnet-4-0',
37+
'anthropic:claude-sonnet-4-5',
3838
instructions="""
3939
You are playing a question and answer game. You need to guess what object the other player is thinking of.
4040
Your job is to ask yes/no questions to narrow down the possibilities.
@@ -83,7 +83,7 @@ async def play(resume_id: str | None):
8383
print('resuming existing workflow', resume_id)
8484
await client.get_workflow_handle(resume_id).result() # type: ignore[ReportUnknownMemberType]
8585
else:
86-
await client.execute_workflow( # type: ignore[ReportUnknownMemberType]
86+
await client.execute_workflow(
8787
TwentyQuestionsWorkflow.run,
8888
id=f'twenty_questions-{uuid.uuid4()}',
8989
task_queue='twenty_questions',

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies = [
1010
"fastapi>=0.115.14",
1111
"logfire[asyncpg,fastapi,httpx]>=4.10",
1212
"mcp>=1.15.0",
13-
"pydantic-ai>=1.18.0",
13+
"pydantic-ai>=1.20.0",
1414
"tavily-python>=0.7.12",
1515
"dbos>=2",
1616
]

uv.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)