PATCHBOOK SERIES Part of the Patchbook Series

Chapter 7: What can a single call do?

In earlier chapters, we established the fundamental mental models: an LLM is a stateless pure function (Chapter 4), governed by a system prompt control plane (Chapter 5), and bounded by a finite context window (Chapter 6).

Before we jump into building complex multi-step agents, loops, and retrieval architectures, we must appreciate a profound architectural shift: a single, isolated API call to an LLM can replace months of traditional machine learning infrastructure.

The Six Primitives of a Single LLM Call

The Single-Call Architectural Revolution

In traditional software engineering, solving natural language problems required dedicated machine learning pipelines:

  1. Collecting and cleaning thousands of domain-specific training examples.
  2. Training or fine-tuning specialized models (BERT, spaCy, custom classifiers).
  3. Managing dedicated GPU inference servers, model registries, and drift monitoring.
  4. Writing custom feature extraction code for every new language or format.

With modern foundation models, these distinct NLP tasks collapse into prompt engineering over a single HTTP POST request.

You do not need a multi-agent framework or complex orchestrator for the majority of everyday backend problems. A single well-structured call can reliably perform six core primitives.

                          +-------------------+
                          |  Single LLM Call  |
                          +---------+---------+
                                    |
     +------------+------------+----+----+------------+------------+
     |            |            |         |            |            |
     v            v            v         v            v            v
Transform     Classify      Extract   Summarize    Evaluate      Expand

The Six Core Single-Call Primitives

1. Transformation and Translation

Transformation takes an input payload in one representation and converts it to another without changing its underlying semantic meaning:

// Prompt: "Convert the following user request into a SQL SELECT query for PostgreSQL 16"
// Input: "Find the top 5 customers in Toronto by revenue this year"
// Output:
"SELECT customer_id, name, SUM(amount) AS revenue FROM orders WHERE city = 'Toronto' AND EXTRACT(YEAR FROM created_at) = 2026 GROUP BY customer_id, name ORDER BY revenue DESC LIMIT 5;"

2. Classification and Routing

Classification maps unstructured input text into a bounded, deterministic set of categories. It is the backbone of automated ticket routing, spam filtering, and sentiment detection:

// System Prompt: "Classify incoming tickets into one category: BILLING, TECHNICAL, or ACCESS."
// User: "My security key expired and I cannot log into the admin dashboard."
// Assistant:
{
  "category": "ACCESS",
  "confidence": 0.99,
  "urgent": true
}

By enforcing a strict JSON schema, host applications can route the ticket directly into an internal message queue (e.g., Kafka or RabbitMQ) without manual human triage.

3. Structured Entity Extraction

Extraction pulls specific, structured data fields out of unstructured or messy text:

// User: "Dr. Elena Vance examined patient #9042 at St. Jude's on Aug 18, prescribing 20mg Lisinopril daily."
// Assistant:
{
  "doctor": "Dr. Elena Vance",
  "patient_id": "9042",
  "date": "2026-08-18",
  "facility": "St. Jude's",
  "prescription": {
    "medication": "Lisinopril",
    "dosage": "20mg",
    "frequency": "daily"
  }
}

4. Summarization and Condensation

Summarization compresses large volumes of text while preserving the critical facts, numbers, and decisions.

5. Evaluation and Policy Grading (LLM as a Judge)

Evaluation uses the model to grade content against an explicit rubric or compliance checklist.

// System Prompt: "Evaluate the support response against our verification policy."
// Assistant:
{
  "passed": false,
  "violations": [
    "Agent discussed account balance before confirming 2FA pin."
  ],
  "score": 3.5
}

6. Expansion and Synthesis

Expansion takes sparse, structured inputs (bullet points, configuration flags, or schemas) and synthesizes rich, formatted artifacts:


Architectural Best Practice: Keep It Single-Shot First

A common anti-pattern in modern AI engineering is reaching for complex, multi-turn autonomous agent loops when a simple single-shot API call is sufficient.

Autonomous agents introduce latency, cost, nondeterminism, and potential loop failure modes. Whenever your problem can be framed as a single transformation, classification, extraction, or evaluation, use a single stateless call.

Only when a task requires dynamic environmental feedback (invoking tools, reading database results, branching based on intermediate outputs, and retrying) do you need to step up to multi-turn agent architectures.


Before we build multi-turn systems, however, we must examine the failure modes of single calls. In Chapter 8, we explore Gotchas, Part 1.