惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
Stack Overflow Blog
Stack Overflow Blog
aimingoo的专栏
aimingoo的专栏
The Register - Security
The Register - Security
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
P
Proofpoint News Feed
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Help Net Security
月光博客
月光博客
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Blog — PlanetScale
Blog — PlanetScale
Security Archives - TechRepublic
Security Archives - TechRepublic
MyScale Blog
MyScale Blog
C
Cisco Blogs
Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy & Cybersecurity Law Blog
The GitHub Blog
The GitHub Blog
WordPress大学
WordPress大学
Martin Fowler
Martin Fowler
Hugging Face - Blog
Hugging Face - Blog
P
Privacy International News Feed
G
Google Developers Blog
Recorded Future
Recorded Future
Vercel News
Vercel News
IT之家
IT之家
C
Check Point Blog
G
GRAHAM CLULEY
Recent Announcements
Recent Announcements
M
MIT News - Artificial intelligence
Y
Y Combinator Blog
Project Zero
Project Zero
NISL@THU
NISL@THU
C
Cybersecurity and Infrastructure Security Agency CISA
Hacker News: Ask HN
Hacker News: Ask HN
A
About on SuperTechFans
罗磊的独立博客
T
Troy Hunt's Blog
Know Your Adversary
Know Your Adversary
Scott Helme
Scott Helme
云风的 BLOG
云风的 BLOG
Schneier on Security
Schneier on Security
The Hacker News
The Hacker News
Attack and Defense Labs
Attack and Defense Labs
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Last Week in AI
Last Week in AI
www.infosecurity-magazine.com
www.infosecurity-magazine.com
T
The Blog of Author Tim Ferriss

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
The 7 Building Blocks of Reliable AI Agents (Skip the Frameworks)
bredmond1019 · 2026-06-24 · via DEV Community

When I started building multi-agent systems, I made the mistake most engineers make: I went looking for the right framework. I evaluated LangChain, AutoGPT, and a dozen other options. I built prototypes in each. I spent weeks on tooling instead of solving the actual problem.

The moment things clicked was when I stripped everything back to bare API calls and asked: what does every agent I've shipped actually need? The answer wasn't a framework. It was seven building blocks — patterns that show up in every reliable agentic system I've built, from the Python orchestration framework that drives parallel task execution to the SDLC agentic harness that ships production code.

Here's what I've learned from building and operating these systems: the best AI agents aren't "agentic" in the way the demos make them look. They're mostly deterministic code with surgical, well-scoped calls to language models.

The Two Types of AI Systems (And Why It Matters)

Before the building blocks, this distinction matters enormously.

AI Assistants (Human-in-the-Loop): Users interact directly, can correct mistakes in real time, and expect exploration. Multiple LLM calls make sense. Think pair programming with Cursor, or a chat interface.

Background Automation (No Human Oversight): Errors compound silently. Latency and cost are magnified. Every LLM call needs justification. This is the domain of production agents.

My Python orchestration framework and the support-automation system I built both fall into the second category. They run without a human watching every step. That constraint shaped every architectural decision — and it's why these seven building blocks matter.

# Background automation: minimize and isolate LLM calls
def process_support_ticket(ticket_data: dict) -> dict:
    # Deterministic routing first — no LLM needed here
    if ticket_data["type"] == "refund" and ticket_data["amount"] < 50:
        return handle_refund_automatically(ticket_data)

    # Use LLM only where reasoning is genuinely required
    if requires_classification(ticket_data):
        context = build_classification_context(ticket_data)
        classification = classify_with_llm(context)
        return route_by_classification(classification, ticket_data)

    return standard_response_template(ticket_data)

Most of what I ship is the outer shell — deterministic orchestration code. The LLM handles the reasoning that can't be hard-coded.

Building Block 1: The Intelligence Layer

This is the only actual AI component. Everything else is software engineering.

I use the Anthropic SDK directly — no intermediate abstractions. The API surface is small and stable. Every layer on top is a maintenance liability.

import anthropic

client = anthropic.Anthropic()

def get_llm_response(prompt: str) -> str:
    """The atomic unit of intelligence: a focused, scoped LLM call."""
    message = client.messages.create(
        model="claude-haiku-4-5-20251001",
        max_tokens=1024,
        messages=[{"role": "user", "content": prompt}]
    )
    return message.content[0].text

The hard part isn't the API call. It's everything around it: what you put in the prompt, how you validate what comes back, and how you handle failure. The remaining six building blocks cover exactly that.

Building Block 2: Memory (State Management)

Language models are stateless. They know nothing about previous calls unless you tell them. Memory management is your responsibility entirely.

In the Python orchestration framework, I maintain context across multi-step pipelines explicitly:

def chat_with_memory(conversation_history: list, new_message: str) -> tuple[str, list]:
    """Maintain conversation state across orchestration steps."""
    conversation_history.append({"role": "user", "content": new_message})

    message = client.messages.create(
        model="claude-haiku-4-5-20251001",
        max_tokens=1024,
        messages=conversation_history
    )

    assistant_message = message.content[0].text
    conversation_history.append({
        "role": "assistant",
        "content": assistant_message
    })

    # Keep context window bounded — trim oldest turns when needed
    if len(conversation_history) > 20:
        conversation_history = conversation_history[-20:]

    return assistant_message, conversation_history

In production, conversation history lives in the database, not in RAM. Each message carries a session ID and timestamp. Token counts are tracked explicitly so you can manage context windows before hitting limits — not after.

Note:
In the SDLC agentic harness, each task worktree maintains its own context: the spec file, a running implementation report, and git history. The "memory" is the files on disk, not an in-memory list. This makes every step auditable and resumable.

Building Block 3: Tools (External Integration)

Tools let an agent take action in the world: read a file, call an API, query a database. They're powerful — and expensive. Every tool call is at least two LLM round trips.

The support-automation system I built uses tools conservatively. The vast majority of tickets route deterministically. Tools activate only when the agent genuinely can't proceed without external information.

tools = [
    {
        "name": "lookup_account_status",
        "description": "Look up a customer account's current status and plan details.",
        "input_schema": {
            "type": "object",
            "properties": {
                "account_id": {
                    "type": "string",
                    "description": "The customer account identifier"
                }
            },
            "required": ["account_id"]
        }
    }
]

def agent_with_tools(user_message: str) -> str:
    messages = [{"role": "user", "content": user_message}]

    response = client.messages.create(
        model="claude-sonnet-4-6",
        max_tokens=1024,
        tools=tools,
        messages=messages
    )

    # Process tool use if the model requested it
    if response.stop_reason == "tool_use":
        tool_use = next(b for b in response.content if b.type == "tool_use")
        tool_result = execute_tool(tool_use.name, tool_use.input)

        messages.extend([
            {"role": "assistant", "content": response.content},
            {
                "role": "user",
                "content": [{"type": "tool_result",
                             "tool_use_id": tool_use.id,
                             "content": tool_result}]
            }
        ])

        final = client.messages.create(
            model="claude-sonnet-4-6",
            max_tokens=1024,
            tools=tools,
            messages=messages
        )
        return final.content[0].text

    return response.content[0].text

The rule I follow: if a tool call can be replaced with a pre-query before the LLM sees the prompt, do that instead. Cheaper, faster, and deterministic.

Building Block 4: Validation (Structured Output)

Unstructured LLM output is a liability in production systems. The fix is forcing structured responses and validating them before downstream code touches them.

Anthropic's API supports structured output natively via tool use patterns. I define schemas with Pydantic, which gives me type safety and validation logic in one place:

from pydantic import BaseModel
from typing import Literal
import json

class TicketClassification(BaseModel):
    category: Literal["billing", "technical", "account", "general"]
    urgency: Literal["high", "medium", "low"]
    requires_human: bool
    summary: str

def classify_ticket(ticket_text: str) -> TicketClassification:
    """Structured classification — always returns a validated object."""
    response = client.messages.create(
        model="claude-haiku-4-5-20251001",
        max_tokens=512,
        system=(
            "You are a support ticket classifier. "
            "Return a JSON object with these exact fields: "
            "category (billing/technical/account/general), "
            "urgency (high/medium/low), "
            "requires_human (boolean), "
            "summary (one sentence). Return only JSON."
        ),
        messages=[{"role": "user", "content": ticket_text}]
    )

    raw = response.content[0].text
    data = json.loads(raw)
    return TicketClassification(**data)

In the SDLC harness, every implement step returns a structured report. The orchestrator reads that report as data, not as prose. When an agent produces output that doesn't match the expected shape, it fails fast and clearly — not silently downstream.


Structured output is the single highest-leverage reliability improvement I've made to agentic systems. It converts probabilistic text generation into deterministic data extraction that downstream code can depend on.

Building Block 5: Control Flow (Deterministic Routing)

This is the pattern that made the biggest difference when I productionized the support-automation system. Instead of handing control to the LLM, I use the LLM for classification and then let deterministic code do the routing.

def handle_support_request(ticket: dict) -> str:
    """One LLM call for classification; deterministic routing after."""
    classification = classify_ticket(ticket["body"])

    # Log the classification — this is invaluable for debugging
    print(f"Category: {classification.category}")
    print(f"Urgency: {classification.urgency}")
    print(f"Requires human: {classification.requires_human}")

    # Deterministic routing — no more LLM calls for most paths
    if classification.requires_human or classification.urgency == "high":
        return escalate_to_human_queue(ticket, classification)

    if classification.category == "billing":
        return handle_billing_ticket(ticket, classification)

    if classification.category == "technical":
        return handle_technical_ticket(ticket, classification)

    return generate_general_response(ticket, classification)

The key insight: the LLM's job is to understand the input, not to drive the execution. Once the intent is classified and the confidence is above threshold, the rest is a state machine.

In the SDLC harness, this pattern runs end-to-end: each pipeline stage classifies what the previous agent produced (PASS / FAIL / PARTIAL), then routes deterministically — implement, test, review, document, or retry. No agent decides its own next step.

Building Block 6: Recovery (Error Handling)

Production agents fail. APIs time out, rate limits hit, models return malformed output. The question isn't whether failures happen — it's whether your system degrades gracefully.

The Python orchestration framework uses a circuit-breaker pattern combined with exponential backoff. Individual task failures don't cascade:

import time
import logging
from typing import Optional

def resilient_llm_call(
    prompt: str,
    max_retries: int = 3,
    backoff_base: float = 2.0
) -> Optional[str]:
    """Production-ready call with retry and graceful fallback."""
    for attempt in range(max_retries):
        try:
            message = client.messages.create(
                model="claude-haiku-4-5-20251001",
                max_tokens=1024,
                messages=[{"role": "user", "content": prompt}]
            )
            result = message.content[0].text
            if not result or len(result.strip()) < 10:
                raise ValueError("Response too short — likely an error state")
            return result

        except Exception as e:
            logging.warning(
                f"LLM call failed (attempt {attempt + 1}/{max_retries}): {e}"
            )
            if attempt < max_retries - 1:
                time.sleep(backoff_base ** attempt)
            else:
                logging.error(f"All {max_retries} attempts exhausted")
                return None

    return None

def process_with_fallback(input_data: dict) -> str:
    """Graceful degradation when the LLM path fails."""
    ai_result = resilient_llm_call(build_prompt(input_data))

    if ai_result:
        return ai_result

    # Rule-based fallback — always have one before you ship
    logging.info("Falling back to rule-based processing")
    return rule_based_response(input_data)

Warning:
Build the fallback path before you build the AI path. If you can't describe what your system does when the LLM fails, you're not ready to ship it.

Building Block 7: Human Oversight

Not every decision should be fully automated. For operations with significant consequences — sending a message to a customer, modifying critical data, triggering an irreversible action — a human checkpoint is worth the latency.

The SDLC harness implements this at the review stage: after an agent implements and tests a task, a review step evaluates the result against acceptance criteria. Clean passes continue automatically; ambiguous or failed results either retry (automated) or escalate to a human. Automation handles scale; humans handle accountability.

from enum import Enum
from dataclasses import dataclass, field
from datetime import datetime
from typing import Optional

class ApprovalStatus(Enum):
    PENDING = "pending"
    APPROVED = "approved"
    REJECTED = "rejected"

@dataclass
class ApprovalRequest:
    id: str
    content: str
    context: dict
    status: ApprovalStatus = ApprovalStatus.PENDING
    created_at: datetime = field(default_factory=datetime.now)

def generate_with_approval(
    prompt: str,
    require_approval: bool = True
) -> Optional[str]:
    """Generate content with an optional human approval gate."""
    draft = resilient_llm_call(prompt)

    if not draft:
        return None

    if not require_approval:
        return draft

    # In production: store the request, notify via webhook/Slack, await response
    request = ApprovalRequest(
        id=generate_id(),
        content=draft,
        context={"prompt": prompt}
    )
    store_approval_request(request)
    notify_approver(request)

    return poll_for_approval(request.id, timeout_seconds=300)

In the support-automation system, high-urgency escalations feed into a human review queue. The agent drafts a response; a team member approves or edits before it sends. The automation provides velocity; the human provides accountability where it matters.

Putting It All Together

These building blocks combine into a complete production loop:

class ReliableAgent:
    def __init__(self):
        self.conversation_memory: dict[str, list] = {}
        self.error_counts: dict[str, int] = {}

    def process(self, session_id: str, input_data: dict) -> str:
        try:
            # Block 2: Load conversation context
            history = self.conversation_memory.get(session_id, [])

            # Block 4 + 5: Classify with structured output, route deterministically
            classification = classify_ticket(input_data["body"])

            if classification.requires_human:
                # Block 7: Human oversight for critical paths
                return self.escalate_with_draft(input_data, classification)

            if classification.urgency == "high":
                # Block 3: Tool use only when needed
                account_info = fetch_account_details(input_data["account_id"])
                response = self.generate_with_context(
                    input_data, classification, account_info, history
                )
            else:
                # Block 1: Direct LLM call for routine responses
                response = resilient_llm_call(
                    build_prompt(input_data, classification, history)
                )

            # Block 2: Update memory
            history.append({"role": "user", "content": input_data["body"]})
            history.append({"role": "assistant", "content": response})
            self.conversation_memory[session_id] = history[-10:]

            self.error_counts[session_id] = 0
            return response

        except Exception as e:
            # Block 6: Recovery
            count = self.error_counts.get(session_id, 0) + 1
            self.error_counts[session_id] = count

            if count > 5:
                return "System temporarily unavailable. A team member will follow up."

            return rule_based_response(input_data)

What This Architecture Makes Possible

The support-automation system I built processes a large volume of daily requests with this pattern. What I can tell you from operating it: the deterministic routing layer handles the majority of requests without any LLM call at all. Only the ones requiring genuine language understanding — nuanced complaints, ambiguous multi-part questions, edge cases the rules don't cover — involve a model call.

That constraint — use LLM calls only where they earn their cost — forced better system design across the board. The classification layer got sharper because I had to define what "requires reasoning" actually means. The fallback paths got more complete because I had to think about every failure mode. The observability layer became essential because I needed to see which paths were being taken and why.

The SDLC agentic harness runs the same way. Each pipeline stage is mostly deterministic orchestration code. The agents are scoped to specific reasoning tasks: write implementation, evaluate test results, review against criteria. Everything else is file I/O, git operations, and control flow.

The Seven Building Blocks

To build a reliable production agent, you need all seven:

  1. Intelligence: Direct API calls to the language model — scoped, purposeful, minimal
  2. Memory: Explicit state management — conversation history, session context, persistent storage
  3. Tools: External integrations — used sparingly, only where deterministic pre-fetching won't do
  4. Validation: Structured output with schema enforcement — convert text generation into data extraction
  5. Control Flow: LLM for classification, deterministic code for routing — never let the model drive execution
  6. Recovery: Retry logic, exponential backoff, graceful degradation — always have a fallback
  7. Human Oversight: Approval checkpoints for high-consequence operations — automation handles scale, humans handle accountability

You don't need a framework. You need these patterns, implemented cleanly, with the Anthropic SDK directly.

Start with one workflow. Map the classification logic. Build the deterministic routing. Add an LLM call only where you genuinely can't route without it. The framework will emerge from the patterns — and it will be one you understand completely.


If you're evaluating frameworks right now, pause. Pick one real workflow in your system and write it using just these seven building blocks with direct SDK calls. The clarity you get from that exercise will shape every architectural decision after it.


If this was useful, I write about building production AI and agentic systems at learn-agentic-ai.com — including hands-on learning paths available in both English and Brazilian Portuguese. Come build something real.