Skip to content

Commit 1c259a8

Browse files
committed
Fix default template for async
1 parent 44553c0 commit 1c259a8

File tree

1 file changed

+18
-0
lines changed
  • src/agentex/lib/cli/templates/default/project

1 file changed

+18
-0
lines changed

src/agentex/lib/cli/templates/default/project/acp.py.j2

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,24 @@ async def handle_task_event_send(params: SendEventParams):
1616
# so you can see where and how messages within a task are handled
1717
print(f"Hello world! I just received this message: {params}")
1818

19+
await adk.messages.create(
20+
task_id=params.task.id,
21+
trace_id=params.task.id,
22+
content=TextContent(
23+
author="user",
24+
content=params.event.content,
25+
),
26+
)
27+
28+
await adk.messages.create(
29+
task_id=params.task.id,
30+
trace_id=params.task.id,
31+
content=TextContent(
32+
author="agent",
33+
content="Hello world! I just received this message: {params.event.content}",
34+
),
35+
)
36+
1937
@acp.on_task_cancel
2038
async def handle_task_canceled(params: CancelTaskParams):
2139
# For this tutorial, we print the parameters sent to the handler

0 commit comments

Comments
 (0)