Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

dev: Add a step to watch claim update in real time

Clémence Lesné664e6c3f9b09
diff --git a/Makefile b/Makefile
index 4345533..009733d 100644
--- a/Makefile
+++ b/Makefile
@@ -129,3 +129,11 @@ eventgrid-register:
--max-delivery-attempts 8 \
--name $(name) \
--source-resource-id $(source)
+
+watch-call:
+ @echo "👀 Watching status of $(phone_number)..."
+ while true; do \
+ clear; \
+ curl -s "$(endpoint)/call?phone_number=%2B$(phone_number)" | yq --prettyPrint '.[0] | {"phone_number": .phone_number, "claim": .claim, "reminders": .reminders}'; \
+ sleep 3; \
+ done
diff --git a/main.py b/main.py
index ddd6c74..dd7ed95 100644
--- a/main.py
+++ b/main.py
@@ -426,12 +426,16 @@ async def intelligence(call: CallModel, client: CallConnectionClient) -> None:
IndentAction.UPDATED_CLAIM,
IndentAction.NEW_OR_UPDATED_REMINDER,
):
+ # Save in DB allowing demos to be more "real-time"
+ await save_call(call)
+ # Answer with intermediate response
await handle_play(
call=call,
client=client,
store=False,
text=chat_res.content,
)
+ # Recursively call intelligence to continue the conversation
await intelligence(call, client)
else: