Practical building · Module 5

Integration and APIs

Computer use is moving from demo territory into real workflows, but the safe lesson is not which model tops which benchmark.

1h 3 outcomes Practical building

Previously

Model Context Protocol (MCP)

The Model Context Protocol (MCP) is an open protocol for connecting AI clients to external tools and data sources.

This module

Integration and APIs

Computer use is moving from demo territory into real workflows, but the safe lesson is not which model tops which benchmark.

Next

Practical building practice test

Test recall and judgement against the governed stage question bank before you move on.

Progress

Mark this module complete when you can explain it without rereading every paragraph.

Why this matters

Computer use is impressive but not magic.

What you will be able to do

  • 1 Connect an agent to an external API and handle authentication safely.
  • 2 Design rate limiting and retries that do not melt production.
  • 3 Return clear errors and keep logs that support debugging.

Before you begin

  • Core concepts completed or equivalent understanding
  • Basic confidence with workflow and integration terms

Common ways people get this wrong

  • Rate limit collapse. Without backoff, one busy hour becomes a self inflicted outage.
  • API drift. A version bump can break behaviour silently. Monitor and test against real responses.

3.5.2 Computer use. Agents that see and click

Computer use is moving from demo territory into real workflows, but the safe lesson is not which model tops which benchmark. The safe lesson is when UI automation is appropriate and when it is reckless.

In practice, computer use is best treated as a fallback when no reliable API exists. If an API is available, use the API. UI automation should be the controlled exception, not the default integration path.

Stage 3 Assessment

You now move from guided building to evidence based checking. This quiz verifies that you can wire tools safely, handle failures cleanly, and choose integration patterns that remain supportable in production.

Summary

In this stage, you have built:

  1. A complete ReAct agent with tools for calculation, search, and more

  2. Multi-agent systems using Supervisor and Swarm patterns, and compared the design questions that matter when picking a framework

  3. Visual workflows with n8n for no-code AI automation

  4. An MCP server that connects to a client, and learned how open protocol governance affects interoperability decisions

  5. Robust API integrations with proper authentication and error handling

  6. Computer use capabilities and what they mean for the next generation of agents

Mental model

Integration is a contract

APIs are promises. Robust agents handle timeouts, errors, and version changes without drama.

  1. 1

    Agent

  2. 2

    API boundary

  3. 3

    External service

  4. 4

    Limits and retries

  5. 5

    Result

Assumptions to keep in mind

  • Failures are expected. Timeouts and 500s are normal. Design for them.
  • Data is validated. Treat external responses as untrusted. Validate before use.

Failure modes to notice

  • Rate limit collapse. Without backoff, one busy hour becomes a self inflicted outage.
  • API drift. A version bump can break behaviour silently. Monitor and test against real responses.

Check yourself

Quick check. Integration and APIs

0 of 4 opened

Where should you store API keys by default

In environment variables or a secret manager, not hard coded in code.

What is a sensible retry strategy for rate limits

Bounded retries with backoff and jitter, respecting server headers where available.

Scenario. An API fails intermittently. What do you log to make it debuggable

Request id, endpoint, status code, timing, and a safe summary of inputs and outputs, without leaking secrets.

Why should monitoring include cost signals

Because usage spikes and runaway loops can turn into a billing incident quickly.

Module 3.1-3.2: Agent Building Quiz

0 of 5 opened

What is the purpose of the to_prompt_format method in a Tool class?
  1. To execute the tool
  2. To format the tool for inclusion in agent prompts
  3. To validate tool inputs
  4. To log tool usage

Correct answer: To format the tool for inclusion in agent prompts

The to_prompt_format method formats the tool's name, parameters, and description so it can be included in the agent's prompt, helping the LLM understand what tools are available.

In the Supervisor pattern, what is the supervisor's main role?
  1. Execute all tasks directly
  2. Route requests to specialised agents
  3. Store conversation history
  4. Handle error logging

Correct answer: Route requests to specialised agents

The supervisor's main role is to route requests to the most appropriate specialised agent and synthesise their responses. It coordinates but does not do the specialised work itself.

What happens when an agent tries to use a tool that does not exist?
  1. The agent crashes
  2. A helpful error message is returned
  3. The tool is automatically created
  4. The query is ignored

Correct answer: A helpful error message is returned

Good agent implementations return a helpful error message listing available tools. This allows the agent to correct its mistake in the next iteration.

Why do we use JSON for Action Input in the ReAct pattern?
  1. Because it is faster than text
  2. Because it provides structured, parseable parameters
  3. Because LLMs only output JSON
  4. Because it reduces token usage

Correct answer: Because it provides structured, parseable parameters

JSON provides structured, parseable parameters that can be directly passed to Python functions. This is more reliable than trying to parse free-form text.

What is the main advantage of the Swarm pattern over Supervisor?
  1. Lower latency for simple tasks
  2. Better error handling
  3. Agents can hand off directly without central bottleneck
  4. Easier to implement

Correct answer: Agents can hand off directly without central bottleneck

In the Swarm pattern, agents hand off directly to each other. This avoids the supervisor as a central bottleneck and allows more natural peer-to-peer collaboration.

Module 3.3-3.5: Integration Quiz

0 of 5 opened

What protocol does MCP use for communication?
  1. REST API
  2. GraphQL
  3. JSON-RPC 2.0
  4. gRPC

Correct answer: JSON-RPC 2.0

MCP uses JSON-RPC 2.0 for communication between clients and servers, with transport details defined by the current specification.

What is the main benefit of MCP over custom integrations?
  1. Better performance
  2. Reduced number of total integrations needed
  3. Free hosting
  4. Automatic testing

Correct answer: Reduced number of total integrations needed

MCP reduces integrations from N apps x M tools to N + M implementations. Each app implements MCP once, each tool implements MCP once.

What is n8n best suited for?
  1. Mobile app development
  2. Visual workflow automation with AI
  3. Database management
  4. Video editing

Correct answer: Visual workflow automation with AI

n8n is a visual workflow automation platform with native AI capabilities. It lets you build AI-powered workflows using a drag-and-drop interface.

Why should API keys be stored in environment variables?
  1. They load faster
  2. They are automatically encrypted
  3. They stay out of version control and are easier to rotate
  4. They reduce memory usage

Correct answer: They stay out of version control and are easier to rotate

Environment variables keep secrets out of source code and version control. They can be easily changed without code modifications, making key rotation simpler.

What is exponential backoff?
  1. A type of encryption
  2. Increasing wait time between retry attempts
  3. A memory management technique
  4. A way to compress data

Correct answer: Increasing wait time between retry attempts

Exponential backoff means increasing the wait time between retry attempts (e.g., 1s, 2s, 4s, 8s). This prevents overwhelming servers during outages.

Artefact and reflection

Artefact

An integration checklist you can reuse for real projects.

Reflection

Where in your work would connect an agent to an external api and handle authentication safely. change a decision, and what evidence would make you trust that change?

Optional practice

Store a secret in an environment variable and read it safely.