Skip to content

Program 03 · Module 09 of 10

Module 09: Deployment, Observability and Optimization

Run an agent as a service in a controlled environment. You design the runtime and API, handle background jobs and sessions, trace decisions, monitor quality, cost and latency, optimise with caching and model choice, and operate versions and rollbacks.

Suggested study time
8-10 hours
Prerequisites
Modules 1 to 8.; Basic experience deploying a web service and reading its logs.

Sign in to track your progress. Every lesson stays free to read without an account.

Learning outcomes

By the end of this module you will be able to:

  • Design a deployment architecture and API for an agent service.
  • Run long tasks as background jobs with session management.
  • Trace tool calls and agent decisions.
  • Monitor quality, failures, latency and cost.
  • Version prompts and models, and roll back safely.

Lessons

  1. 9.1

    Agent Runtime and Deployment Architecture

    Decide where an agent's loop runs, where its state is stored, how the outside world reaches it and where its secrets live, before you put it on a server.

    40 min
  2. 9.2

    API Design, Background Jobs and Session Management

    Design the endpoints that expose an agent, return clear errors, run long tasks as background jobs that clients poll, and keep session state that expires.

    45 min
  3. 9.3

    Tracing Tool Calls and Agent Decisions

    Record every model call, tool call and check of one agent run as a small, redacted event, so you can rebuild what happened and find out why.

    40 min
  4. 9.4

    Monitoring Quality, Failures, Latency and Cost

    Pick a few numbers that show whether an AI agent is healthy, read them from your traces, and set alerts so you hear about a problem before your customers do.

    40 min
  5. 9.5

    Caching, Model Selection and Token Optimization

    Cut the cost and waiting time of an AI agent by reusing safe answers, giving simple steps to a smaller model and sending the model less text, then prove each change with numbers.

    40 min
  6. 9.6

    Versioning, Rollbacks and Production Operations

    Give every behaviour-changing part of an agent a version, stamp that version on every trace, and learn to switch back to the last good version fast when a release goes wrong.

    40 min
  7. 9.7

    Practical Lab: Deploy and Monitor an Agent Service

    Wrap your support agent in a small web service, record a trace of every run, summarise the traces with a monitor script, switch between two versions with one file and practise a rollback.

    2 h

About 6 h 5 min of lessons in total.

Practical assignment

Practical Lab: Deploy and Monitor an Agent Service

Deploy an agent as a service in a controlled test environment with an API, tracing, basic dashboards or logs, and a documented rollback.

Deliverables

  • A running service with documented endpoints.
  • A trace of one complete run with each tool call.
  • A monitoring view of latency, errors and cost per run.
  • A rollback procedure that you have exercised.

Validation checklist

Use this to check your assignment before you move on.

Knowledge check

  1. 1.Why record prompt and model versions with each run?
    Show the answer and explanation

    Answer: B. Without versions, a regression cannot be attributed. The provider does not require it, but you will need it when diagnosing.

  2. 2.What is a sensible way to run a task that takes minutes?
    Show the answer and explanation

    Answer: B. Long requests hit timeouts and are hard to resume. A job ID gives the client a stable handle.

PromptFable is independent and is not affiliated with, endorsed by or sponsored by Anthropic, Google, OpenAI or any other vendor. Claude, Gemini, Google AI Studio and other product names are trademarks of their respective owners.