11.1.1 · Skill in AI engineering

LLM integration

Calling language models from a product reliably.

Integrating an LLM means prompts, model choice, streaming, retries, timeouts and cost control. Prompts are code and deserve versioning and tests. The model is a dependency that changes, so the integration has to absorb that.

Your status · LLM integration

Saved in this browser. Sign in to keep it on every device.It colours this skill's tile on your map.

Why it matters for a product engineer

A model call looks like one line of code, but it behaves like a slow, expensive and sometimes unreliable service. Answers can take seconds, the provider can be down, limits can block you, and the same prompt can give a different answer after a model update. The product around the call decides what users see in each of these cases. Product engineers own that product: the prompt, the model choice, the waiting state, and what happens when the call fails.

How to do it

  1. Start with the simplest design that works: one well-written prompt before chains or agents.
  2. Keep prompts in version control, next to a small set of test inputs with expected results.
  3. Pin a model version, and run the tests before you switch to a new one.
  4. Stream long answers, so users see progress instead of a spinner.
  5. Plan for failure: a second model or provider, a cached answer, or the feature without AI.

Common mistakes

  • Prompts written as strings inside the code, changed without any test.
  • Using an alias that points to the newest model, so behavior changes without a deploy.
  • Unlimited retries that multiply cost during a provider outage.
  • Treating model output as trusted, valid data without checking its format.

Example

On 11 December 2024, every OpenAI service, including the API, was degraded or unavailable for about four hours and twenty minutes. The cause was inside OpenAI: a new telemetry service overloaded the control plane of its large Kubernetes clusters. The API was mostly back after about two hours and twenty minutes, and fully back for all models at 7:38 PM PST. A product that called only this API could not fix anything. It could only decide what its users saw while it waited.

Timeline

OpenAI's outage, 11 December 2024 (PST)

  1. 3:12 PMTelemetry service deployedTested in staging the day before
  2. 3:16 PMAll services start to degradeProblem
  3. 3:40 PMMaximum customer impactProblem
  4. 5:36 PMAPI mostly recovered
  5. 7:38 PMAll models recoveredResult

For a product that depends on one provider, an outage like this lasts hours. Only timeouts and a fallback decide what users see during it.

ReportedOpenAI Status, incident write-up, December 2024

Sources: API, ChatGPT & Sora facing issues: write-up (OpenAI Status) ↗ · Building effective AI agents (Anthropic) ↗ · Prompt engineering overview (Anthropic docs) ↗

Technical leverage

Wrap model calls behind a stable interface with timeouts, bounded retries, streaming and measurable cost, so a dependency failure does not become a broken journey.

Evidence of mastery

Put it into practice
Practice
Build a small AI feature with a useful fallback and exercise provider failures.
Artifact
A working integration with failure tests and latency and cost measurements.

What good looks like

  • Timeouts, rate limits and invalid output have defined behavior.
  • Model choice is justified against the actual task and a simpler baseline.

Use this evidence to assess your work. Your map status is a self-assessment, not a certification.

Resources

2
  • docsStart here
    Prompt engineering overview ↗
    Anthropic docs · 5 min

    Where to start when a model's output is not good enough, before changing models or adding complexity.

  • articleStart here
    Building effective AI agents ↗
    Anthropic · 2024 · 12 min

    When a simple workflow beats an agent, and the handful of patterns that cover most real systems.

Tools

2
Tools for AI engineering