Skip to content

Commit a003f61

Browse files
authored
continue as new example (#254)
1 parent aed2e4b commit a003f61

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

agent_chat/pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ dependencies = [
1010
"watchfiles>=1.0.4",
1111
"python-dotenv==1.0.1",
1212
"openai>=1.61.0",
13-
"restack-ai>=0.0.94",]
13+
"restack-ai>=0.0.100",
14+
]
1415

1516
[project.scripts]
1617
dev = "src.services:watch_services"

agent_chat/src/agents/agent.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,10 @@ async def end(self, end: EndEvent) -> EndEvent:
4949
@agent.run
5050
async def run(self, function_input: dict) -> None:
5151
log.info("AgentChat function_input", function_input=function_input)
52-
await agent.condition(lambda: self.end)
52+
await agent.condition(lambda: self.end or agent.should_continue_as_new())
53+
54+
if self.end is True:
55+
log.info("AgentChat end")
56+
return
57+
58+
await agent.agent_continue_as_new()

0 commit comments

Comments
 (0)