LIVE β€’ SYSTEMS ARCHITECTURE & MODERN DEV STACK
HostingerOfficial Partner
🌐id
Cloud VPS6 min read

Orchestrating LLM Agents: Self-Host Hatchet on VPS

Eliminate HTTP 504 timeouts and worker crashes in long-running LLM workflows using Hatchet and PostgreSQL on KVM VPS. Build durable stateful AI agents.

IP
By Iswan Putera β€’ November 17, 2026 11:30 WIB
Orchestrating LLM Agents: Self-Host Hatchet on VPS

Execution failures in multi-step LLM chains caused by HTTP 504 Gateway Timeouts or unhandled worker crashes represent a major operational nightmare for agentic AI engineers. When an AI workflow involves long-running document analysis, recursive entity extraction, or dynamic web scraping spanning several minutes, traditional stateless HTTP architectures collapse under real-world load.

Without persistent step-level state tracking, a crash at minute five forces the entire pipeline to restart from scratch. This wastes valuable LLM API tokens and causes cloud infrastructure bills to balloon rapidly. While implementing an asynchronous AI queue architecture using Redis works well for lightweight job queues, it lacks native durable execution mechanics required to maintain complex Directed Acyclic Graph (DAG) state across server crashes.

Architectural Shift: Stateless Queues vs. Durable Execution Engines

To build resilient enterprise LLM orchestration pipelines, engineering teams must transition from simple task queuing to durable stateful execution. Durable engines like Hatchet combine a lightweight, high-throughput Go engine with robust PostgreSQL state persistence.

Every individual step in an AI workflow is isolated and transactionally committed to the database. If a worker node suffers an Out-Of-Memory (OOM) event or network disruption mid-execution, Hatchet resumes execution precisely at the point of failure (step-level recovery) without re-running previously successful LLM calls.

Here is a technical breakdown comparing the primary AI orchestration choices:

Architectural Parameter BullMQ (Redis In-Memory) Hatchet Engine (Self-Hosted) Temporal Cloud (Managed SaaS)
Execution Model Stateless Job Queue Durable Stateful DAG Durable Event Sourcing
State Persistence Transient (Volatile RAM) ACID-Compliant (PostgreSQL) Distributed Log Store
Step-Level Recovery Manual Retry Logic Native / Step-level Auto Native / Step-level Auto
Orchestration Latency Sub-millisecond Low Latency (<10ms) Variable Cloud Latency
Cost Predictability High (Fixed VPS Cost) High (Fixed VPS Cost) Low (Pay-per-Event Cloud)
Operational Overhead Low Low (Docker Native) High (Vendor Lock-in)
  • Execution Model β€” BullMQ (Redis In-Memory): Stateless Job Queue | Hatchet Engine (Self-Hosted): Durable Stateful DAG | Temporal Cloud (Managed SaaS): Durable Event Sourcing
  • State Persistence β€” BullMQ (Redis In-Memory): Transient (Volatile RAM) | Hatchet Engine (Self-Hosted): ACID-Compliant (PostgreSQL) | Temporal Cloud (Managed SaaS): Distributed Log Store
  • Step-Level Recovery β€” BullMQ (Redis In-Memory): Manual Retry Logic | Hatchet Engine (Self-Hosted): Native / Step-level Auto | Temporal Cloud (Managed SaaS): Native / Step-level Auto
  • Orchestration Latency β€” BullMQ (Redis In-Memory): Sub-millisecond | Hatchet Engine (Self-Hosted): Low Latency (<10ms) | Temporal Cloud (Managed SaaS): Variable Cloud Latency
  • Cost Predictability β€” BullMQ (Redis In-Memory): High (Fixed VPS Cost) | Hatchet Engine (Self-Hosted): High (Fixed VPS Cost) | Temporal Cloud (Managed SaaS): Low (Pay-per-Event Cloud)
  • Operational Overhead β€” BullMQ (Redis In-Memory): Low | Hatchet Engine (Self-Hosted): Low (Docker Native) | Temporal Cloud (Managed SaaS): High (Vendor Lock-in)

Relying on managed SaaS vendors often results in unpredictable monthly bills as transaction volume scales up. Deploying Hatchet on self-hosted infrastructure presents an optimal path for data sovereignty, cost control, and operational stability.

Deploying Hatchet Engine on Hostinger KVM VPS Infrastructure

Self-hosting the Hatchet Engine requires hardware with guaranteed CPU allocations and rapid storage I/O to handle constant PostgreSQL state updates. Leveraging a high-performance Hostinger KVM VPS infrastructure powered by NVMe storage provides the necessary throughput to process thousands of workflow step updates per second without I/O bottlenecks.

The deployment architecture consists of three core services: PostgreSQL as the durable state store, the Hatchet Engine/Controller, and the isolated Worker Nodes executing your LLM agents. This stack seamlessly pairs with an orchestrated multi-AI agent setup via Docker Compose.

Below is a lightweight, production-ready configuration snippet:

version: '3.8'
services:
 hatchet-postgres:
 image: postgres:16-alpine
 environment:
 POSTGRES_DB: hatchet
 POSTGRES_USER: hatchet_user
 POSTGRES_PASSWORD: secure_db_password
 volumes:
 - hatchet_pgdata:/var/lib/postgresql/data
 hatchet-engine:
 image: ghcr.io/hatchet-dev/hatchet/hatchet-engine:latest
 environment:
 DATABASE_URL: postgres://hatchet_user:secure_db_password@hatchet-postgres:5432/hatchet
 ports:
 - "7077:7077"
 - "8080:8080"
 depends_on:
 - hatchet-postgres
volumes:
 hatchet_pgdata:

Advanced Fault Tolerance & Token Bucket Concurrency Control

A critical advantage of the Hatchet Engine is its native implementation of rate limiting and concurrency control via the Token Bucket algorithm. When running agentic AI loops that make parallel requests to external API providers like OpenAI or Anthropic, unmanaged execution inevitably causes HTTP 429 Rate Limit Exceeded errors.

By unifying step-level retry policies with engine-level token bucket limits, engineering teams achieve three key outcomes:

  1. Execution State Recovery: In the event of a total host failure, Hatchet automatically re-assigns uncompleted DAG steps to alternate active workers within milliseconds.
  2. Token Bucket Concurrency: Prevents API throttling by enforcing strict rate limits per LLM provider directly at the execution engine layer.
  3. Optimized RAM Footprint: TypeScript and Python workers consume system memory only during active step evaluation, significantly reducing idle memory overhead on your VPS compared to continuous polling loops.

Efisiensi komputasi ini dapat diterapkan secara optimal pada infrastruktur yang andal.

Transitioning long-running LLM workflows from fragile stateless queues to a durable execution model backed by Hatchet and PostgreSQL guarantees high availability and operational reliability. Running this stack on top of a dedicated Hostinger KVM VPS server guarantees low latency and fixed, predictable infrastructure costs.

Transparency: Some links in this article are affiliate links that may earn us a commission at no additional cost to you.

Share:
Related Tags:#Hostinger#Cloud VPS#Hatchet#AI Agent#DevOps#PostgreSQL#Docker