Let’s Get Certified
Module 12 / 21 · Implementation and integration

Trace an AI feature inside a business application

Locate delays and authorization boundaries in a multi-stage generative AI feature.

Trace an AI feature inside a business application

Work through the decision

An invoice portal stalls for 45 seconds. The model logs show only a one-second call. The rest happens between upload, extraction, retrieval and review. How should the developer locate the delay?

Check your reasoning

Carry one request ID from the portal into every stage and record durations, statuses and safe metadata. Move long extraction to a queued job with visible status. Define who may access the job and what a cancelled job should do with partial output.

Watch the source lesson at 3:07:26

Compare the choices

Expose an asynchronous job contract
Return a job ID with authorized status and result retrieval for work that exceeds a synchronous request deadline.
Orchestrate document stages
Connect extraction, validation, model inference and approval with explicit transitions, retries and failure handling.
Trace spans across tools
Use a shared trace ID and stage timings to distinguish network, retrieval, model and application delays without logging sensitive prompt bodies.
Use tested developer scaffolding
Package API schemas, SDK examples, fixtures and local stubs so integrators can test contracts without live inference.

Read a distributed trace

A portal request spends 25 s waiting for a worker, 12 s in extraction, 1 s generating and 2 s writing a result. The 40 s path is dominated by queue wait. Measure worker capacity and demand before paying for a faster model.

Apply it on AWS

Use Step Functions to coordinate document stages, SQS for a bounded backlog and CloudWatch metrics for queue age. A trace ID across the application, retrieval and model call lets a developer attribute delay without retaining full prompts.

Practice the guide skills

  1. Define streaming and asynchronous interfaces with request limits, status lookup, cancellation and scoped result access. Watch 3:07:26
  2. Create a task form that uses the same validated API as the SDK. Show progress and a recoverable error without exposing credentials. Watch 3:54:23
  3. Orchestrate document extraction, validation, summary and reviewer handoff. Preserve source IDs through every stage. Watch 3:55:47
  4. Ship example payloads, typed schemas, stubs and replayable fixtures. Make a developer reproduce both a success and a timeout. Watch 3:55:08
  5. Route tasks to narrow specialists and choose a shared state contract. Give the supervising workflow a completion test. Watch 2:48:00
  6. Trace a request across retrieval, model and tools. Store durations and status codes under one ID while protecting sensitive content. Watch 6:22:17

Official objectives for this lesson

Related lesson · Build a grounded request from tokens, context and tools

Knowledge check

Trace an AI feature inside a business application quiz

Answer 3 questions. Check each answer for an explanation.