<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/agents-that-run-for-three-days-peic8mtvw" -->

---
title: Agents that run for three days | daily.dev
description: AgentField's blog walks through building long-running AI agents that execute asynchronously via a fire-and-forget HTTP pattern: POST once, get a 202, and...
canonical: https://daily.dev/posts/agents-that-run-for-three-days-peic8mtvw
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Agents that run for three days | daily.dev
og:description: AgentField's blog walks through building long-running AI agents that execute asynchronously via a fire-and-forget HTTP pattern: POST once, get a 202, and...
og:url: https://daily.dev/posts/agents-that-run-for-three-days-peic8mtvw
og:image: https://api.daily.dev/og/posts/peIc8mtvW.png
og:image:alt: Agents that run for three days
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Agents that run for three days

**[AgentField.ai](https://daily.dev/sources/agentfield)** · 8 min read · 1 upvotes · 0 comments

## Summary

AgentField's blog walks through building long-running AI agents that execute asynchronously via a fire-and-forget HTTP pattern: POST once, get a 202, and receive a signed webhook (HMAC-SHA256) when the job finishes hours or days later. The underlying execution is backed by a durable PostgreSQL queue with worker lease expiry and webhook retries (up to 5 attempts with exponential backoff). It covers a Python reasoner example with memory-based checkpointing for crash recovery, webhook signature verification code, SSE for live progress monitoring, and equivalent Go/TypeScript SDK registration, plus a CLI snippet for scaffolding the pattern with coding agents.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://agentfield.ai/blog/agents-that-run-for-days>

## Questions this post answers

### How do I verify an HMAC webhook signature in Python to confirm a payload wasn't tampered with?

Recompute the HMAC-SHA256 digest over the raw request body bytes using the shared secret, prefix it with 'sha256=', and compare it to the signature header using hmac.compare_digest rather than the == operator to avoid timing attacks. Verification must run against the raw bytes, not a re-serialized JSON object, since re-encoding changes the byte sequence and breaks the signature match.

_daily.dev surfaces practical webhook security patterns like this for developers hardening API integrations._

### How can I run a long-running AI agent task without hitting an HTTP request timeout?

Use an asynchronous fire-and-forget pattern: POST the job to an async endpoint, receive an immediate 202 response with an execution id, then close the connection entirely. The job executes in a worker process outside any request lifecycle, so there's no 30-60 second proxy timeout to hit, and a signed webhook delivers the result to a specified URL once the job completes, even if that takes days.

_developers wiring up long-running agent workflows can track async execution patterns like this on daily.dev._

### How many times does a webhook delivery get retried if my receiving server is down or returns a 5xx error?

Up to 5 delivery attempts with exponential backoff: immediate, then +5s, +10s, +20s, and +40s, with the backoff interval capped at 5 minutes. Pending deliveries are stored in a PostgreSQL-backed queue so they survive a control plane restart, and the dispatcher resumes scanning for due deliveries on warm start, making receivers that key on execution_id for idempotency a requirement.

_teams building reliable webhook consumers can find durability patterns like this via daily.dev._

## Similar posts on daily.dev

- [Realtime AI Agent - A Deep Dive](https://daily.dev/posts/realtime-ai-agent---a-deep-dive-q4v3vciti) · System Design Newsletter · 0 upvotes · 0 comments
- [Long-running Agents](https://daily.dev/posts/long-running-agents-irtro0veg) · Addy Osmani · 78 upvotes · 3 comments
- [Long-running Agents](https://daily.dev/posts/long-running-agents-5udbvhegl) · Elevate · 33 upvotes · 0 comments
- [Vercel Releases Open Agents to Support Background AI Coding Workflows](https://daily.dev/posts/vercel-releases-open-agents-to-support-background-ai-coding-workflows-rqcak8vwn) · InfoQ · 1 upvotes · 1 comments
- [The agent is not the system. Postgres is.](https://daily.dev/posts/the-agent-is-not-the-system-postgres-is--hqvmc46rn) · Planet PostgreSQL · 1 upvotes · 0 comments

---

Tags: [#python](https://daily.dev/tags/python), [#ai-agents](https://daily.dev/tags/ai-agents), [#postgresql](https://daily.dev/tags/postgresql)

[View this post on daily.dev](https://daily.dev/posts/agents-that-run-for-three-days-peic8mtvw)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Agents that run for three days","url":"https://daily.dev/posts/agents-that-run-for-three-days-peic8mtvw","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/agents-that-run-for-three-days-peic8mtvw"},"datePublished":"2026-10-02T17:45:22.217Z","dateModified":"2026-10-03T17:36:47.214Z","description":"AgentField's blog walks through building long-running AI agents that execute asynchronously via a fire-and-forget HTTP pattern: POST once, get a 202, and...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/3f4267f4b5c07c7e553db69434ab2945?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/3f4267f4b5c07c7e553db69434ab2945?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"AgentField.ai","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"AgentField.ai","logo":"https://media.daily.dev/image/upload/s--VLFHaedl--/f_auto/v1791063152/squads/33beeb91-1f14-4d9b-9cf8-db7d9f69160a?_a=BAMAMicg0","url":"https://daily.dev/squads/agentfield"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/agents-that-run-for-three-days-peic8mtvw","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"python,ai-agents,postgresql","timeRequired":"PT8M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"AgentField.ai","item":"https://daily.dev/squads/agentfield"},{"@type":"ListItem","position":3,"name":"Agents that run for three days"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/agents-that-run-for-three-days-peic8mtvw#faq","mainEntity":[{"@type":"Question","name":"How do I verify an HMAC webhook signature in Python to confirm a payload wasn't tampered with?","acceptedAnswer":{"@type":"Answer","text":"Recompute the HMAC-SHA256 digest over the raw request body bytes using the shared secret, prefix it with 'sha256=', and compare it to the signature header using hmac.compare_digest rather than the == operator to avoid timing attacks. Verification must run against the raw bytes, not a re-serialized JSON object, since re-encoding changes the byte sequence and breaks the signature match. daily.dev surfaces practical webhook security patterns like this for developers hardening API integrations."}},{"@type":"Question","name":"How can I run a long-running AI agent task without hitting an HTTP request timeout?","acceptedAnswer":{"@type":"Answer","text":"Use an asynchronous fire-and-forget pattern: POST the job to an async endpoint, receive an immediate 202 response with an execution id, then close the connection entirely. The job executes in a worker process outside any request lifecycle, so there's no 30-60 second proxy timeout to hit, and a signed webhook delivers the result to a specified URL once the job completes, even if that takes days. developers wiring up long-running agent workflows can track async execution patterns like this on daily.dev."}},{"@type":"Question","name":"How many times does a webhook delivery get retried if my receiving server is down or returns a 5xx error?","acceptedAnswer":{"@type":"Answer","text":"Up to 5 delivery attempts with exponential backoff: immediate, then +5s, +10s, +20s, and +40s, with the backoff interval capped at 5 minutes. Pending deliveries are stored in a PostgreSQL-backed queue so they survive a control plane restart, and the dispatcher resumes scanning for due deliveries on warm start, making receivers that key on execution_id for idempotency a requirement. teams building reliable webhook consumers can find durability patterns like this via daily.dev."}}]}
```

