Stacks Horizon

All posts

Search: “updates” Category: Code and Tech — 6 articles.

6 articles in Code and Tech · matching updates

  • Building Resilient Event-Driven Backend Pipelines with Go and NATS JetStream
    Code and Tech

    Building Resilient Event-Driven Backend Pipelines with Go and NATS JetStream

    The Problem: Direct, synchronous HTTP/gRPC microservice calls create tight coupling and cascading failures when downstream services lag or fail. The Solution: Event-Driven Architecture (EDA) using NATS JetStream decouples API handlers from heavy background jobs using persistent, low-latency messaging streams. Core Setup: Streams: Persist events to disk (ORDERS.*) with defined retention policies. Producers: Publish JSON payloads synchronously to guarantee NATS receives the write. Durable Pull Consumers: Fetch batches of messages, execute processing, and explicitly send ACK upon success or NAK to request a retry. Production Best Practices: Transactional Outbox: Prevents database state and message publishing from drifting out of sync. Idempotency: Protects against duplicate event execution using unique order IDs in a cache like Redis. Dead Letter Queues (DLQ): Prevents permanently failing or malformed messages from blocking consumer workers.

    Read more
  • Building Agentic Workflows in Python: Beyond Basic RAG with LangGraph
    Code and Tech

    Building Agentic Workflows in Python: Beyond Basic RAG with LangGraph

    Here is a quick breakdown of what the article covers: * **The Shift:** Traditional RAG follows a rigid, linear pipeline (`Retrieve -> Generate`). **Agentic RAG** introduces dynamic, self-correcting loops using the LLM as a reasoning engine within a state machine. * **Why LangGraph:** Unlike standard DAG (Directed Acyclic Graph) pipelines, LangGraph supports **cyclic workflows** (loops), enabling self-evaluation, error handling, and tool re-invocations. * **Core Architecture:** Built around three elements: * **State:** A shared dictionary (`AgentState`) tracking history and variables across steps. * **Nodes:** Python functions that execute steps (agent reasoning, evaluation, web search). * **Edges:** Conditional routes that direct execution flow based on state evaluation. * **Production Best Practices:** Always enforce **iteration limits** to prevent infinite loops, use **lightweight models** for evaluators to reduce latency, and keep evaluation separate from tool execution.

    Read more