# LangSmith agent run finished notifications on your phone > Get a push notification when a LangGraph agent run finishes, fails or times out, with how long it took and the agent's final answer. - Company: LangSmith (https://www.justpush.io/recipes/langsmith) - Event: `run` (Agent run) - Tags: AI, Monitoring - Install: https://studio.justpush.io/recipes/langsmith/agent-run - Web page: https://www.justpush.io/recipes/langsmith/agent-run ## Setup 1. Click Install in Studio and sign in. The recipe is added to your account and you get a personal webhook URL. 2. Follow the setup notes below: Agent run finished is configured in a different part of LangSmith than the other recipes. 3. Paste your webhook URL (shown in Studio after install) (plus any query parameters from the notes) as the webhook URL and save. 4. LangGraph Platform (Agent Server) calls a webhook when you pass one on the run. Add `webhook` to the request that starts it: 5. ```json 6. POST /threads/{thread_id}/runs 7. { 8. "assistant_id": "research-agent", 9. "input": { "messages": [{ "role": "user", "content": "Summarise this week's support tickets" }] }, 10. "webhook": "your webhook URL (shown in Studio after install)" 11. } 12. ``` 13. The same `webhook` field works on `/runs/wait`, `/runs/stream` and cron jobs. With the Python SDK: `client.runs.create(thread_id, assistant_id, input=..., webhook="your webhook URL (shown in Studio after install)")`. 14. The push shows the agent's last message when it's plain text, which is usually its final answer. ## Code Studio calls `handleRequest(request)` with the incoming webhook (`{ method, headers, body, query, raw }`) and sends the message object it returns. Returning `null` sends nothing. ```js // LangSmith → LangGraph agent run finished // Fires when a LangGraph Platform (Agent Server) run you started with a "webhook" // parameter completes, fails, or times out. Great for long-running agents. // Docs: https://docs.langchain.com/langsmith/use-webhooks // Run statuses, how to label them, and how loud to be. const STATUSES = { success: { title: "✅ Agent run finished", priority: -1 }, error: { title: "❌ Agent run failed", priority: 1 }, timeout: { title: "⏱️ Agent run timed out", priority: 1 }, interrupted: { title: "⏸️ Agent run interrupted", priority: 0 }, } // "2m 14s" from two ISO timestamps. function duration(start, end) { const ms = Date.parse(end) - Date.parse(start) if (!Number.isFinite(ms) || ms < 0) return null const s = Math.round(ms / 1000) return s < 60 ? `${s}s` : `${Math.floor(s / 60)}m ${s % 60}s` } // The agent's last message, if it's text — usually its final answer. function lastMessage(values) { const messages = Array.isArray(values?.messages) ? values.messages : [] const content = messages[messages.length - 1]?.content const text = typeof content === "string" ? content : Array.isArray(content) ? content.map((part) => (typeof part?.text === "string" ? part.text : "")).join(" ") : "" const clean = text.replace(/\s+/g, " ").trim() return clean.length > 140 ? clean.slice(0, 139) + "…" : clean || null } function handleRequest(request) { const run = request.body || {} // Guard: only LangGraph run payloads. if (!run.run_id || !Object.prototype.hasOwnProperty.call(STATUSES, run.status)) { console.log(`Not a finished LangGraph run (status "${run.status ?? "unknown"}") — skipping`) return null } const status = STATUSES[run.status] const took = duration(run.run_started_at ?? run.created_at, run.run_ended_at ?? run.webhook_sent_at) const who = run.assistant_id ? `${run.assistant_id}` : "Agent" const failure = run.error && typeof run.error === "object" ? [run.error.error, run.error.message].filter(Boolean).join(": ") : null const detail = run.status === "success" ? lastMessage(run.values) : failure return { title: status.title, message: `${who}${took ? ` · ${took}` : ""}${detail ? ` — ${detail}` : ""}`, topic: "LangSmith", priority: status.priority, } } ``` ## LangSmith run webhook payload (sample) ```json { "error": null, "kwargs": { "input": { "messages": [ { "role": "user", "content": "Summarise this week's support tickets" } ] } }, "run_id": "1ef6a5b8-4457-6db0-8b15-cffd3797fa04", "status": "success", "values": { "messages": [ { "type": "human", "content": "Summarise this week's support tickets" }, { "type": "ai", "content": "142 tickets this week, up 12%. Top themes: login issues (38), billing questions (27) and export bugs (19)." } ] }, "metadata": [], "thread_id": "9dde5490-2b67-47c8-aa14-4bfec88af217", "created_at": "2026-09-29T09:05:01.000000+00:00", "assistant_id": "research-agent", "run_ended_at": "2026-09-29T09:07:15.500000+00:00", "run_started_at": "2026-09-29T09:05:01.500000+00:00", "webhook_sent_at": "2026-09-29T09:07:15.900000+00:00", "multitask_strategy": "reject" } ``` ## FAQ ### Does this work on iPhone and Android? Yes. Install the JustPush app from the App Store or Google Play and sign in. Every phone signed in to your account gets the notification. ### Do I need to write code? No. Install the recipe in Studio, paste your webhook URL into LangSmith and you are done. The code is there if you want to change the text, the sound or the buttons. ### Can I change what the notification says? Yes. After install the recipe's code is yours. Edit it in Studio and test it against the sample payload before you save. ### What does it cost? JustPush is free for 30 days. After that it's $19.99 a year, or $39.99 once. There is no extra charge for recipes.