Conversation
Co-Authored-By: Aman Ibrahim <aman@deeptrust.ai>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
Original prompt from Aman Ibrahim
|
There was a problem hiding this comment.
Devin Review found 4 potential issues.
3 bugs not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
…ur own client; error-path tests Co-Authored-By: Aman Ibrahim <aman@deeptrust.ai>
Summary
deeptrust.agents.vapi.Bridge— the third adapter, for a customer on VAPI (inbound restaurant calls). Unlike the other two, nothing here holds a connection: VAPI POSTs server messages to the customer's webhook, and the customer callsbridge.handle(payload, user=...)from that route.Per message (
payloadorpayload["message"], keyed oncall.id,platform="vapi"):transcriptwithtranscriptType == "final"(or the filtered type nametranscript[transcriptType="final"]) →session.append(role, text); analyse onuserturns only. Partials are dropped — the same guard against re-analysing one sentence thatlivekit.py'slastdict provides.end-of-call-report→session.end(), and the call is forgotten.Nudge delivery is
POST {controlUrl}with{"type": "add-message", "message": {"role": "system", "content": nudge.render()}, "triggerResponseEnabled": true}which makes the agent respond now — LiveKit-interrupt semantics rather than ElevenLabs' next-turn contextual update. Module docstring and README say so.
controlUrlis taken fromcall.monitor.controlUrlwhen the webhook carries it and it ishttpson a*.vapi.aihost (the body is untrusted input, so a URL pointing elsewhere is dropped), else fetched once per call viaGET https://api.vapi.ai/call/{id}with the VAPI key (under a per-call lock), so inbound calls never created by the customer's code work.listenUrlis not touched. Verifying the webhook's origin (x-vapi-secret) is the customer's route's job and is documented as such.Session.checkuntouched.No new dependency (httpx is core), so no
vapiextra;vapiadded to keywords and to the mypy adapter override.aclosecloses the httpx client only if the bridge created it. Tests intests/test_vapi.pyare respx-only: payload sequence in, analyze calls and control-URL body out, plus lookup/delivery failure paths.The
justfilechecktarget passes (ruff, mypy, 38 tests) locally.Link to Devin session: https://app.devin.ai/sessions/04b304333cb047a49ca2cfd938449671
Open in Devin Desktop: https://app.devin.ai/desktop/session/04b304333cb047a49ca2cfd938449671?variant=devin
Requested by: @amanmibra