Stanford Online

How AI Agents Work: Connectors, MCP & Agent Safety | Stanford CS193T Lecture 5 with Cynthia Bailey

Published 2026-11-17 · Duration 58:53

Summary

This lecture details the architecture of AI agents, moving beyond simple generative content creation to autonomous action execution. Agents utilize 'connectors'—access permissions to external services (e.g., Gmail, Outlook)—which allow the Large Language Model (LLM) to perform actions by generating highly structured JSON text. The core mechanism remains next-token prediction, but the output is interpreted by a 'connector manager' to trigger tool calls. Effective agent design requires defining a detailed scope of work, including goals, context, tools, permissions, memory, actions, and crucial stopping conditions. Safety is paramount, requiring the application of principles like 'least privilege access' and careful mitigation of prompt injection risks.

Download summary

Key takeaways

  1. Agentic AI vs. Generative AI 1:40

    Generative AI focuses on content creation, while agentic AI focuses on taking actions. However, technically, both rely on the LLM's underlying next-token prediction mechanism. When acting, the LLM emits structured JSON text that a connector module intercepts and executes as a tool call.

  2. The Anatomy of an Agent 6:10

    A well-specified agent must define seven parts: goal, context, tools, permissions, memory, actions, and stopping conditions. Stopping conditions are critical, as agents will continue running until explicitly told to stop or until a predefined condition is met.

  3. The Analyze-Act-Observe Loop 11:00

    Agent workflows operate in a continuous loop: the LLM analyzes the context to identify necessary actions, the action is executed via a connector, and the result is observed and fed back into the context for the next analysis cycle. The distinction from traditional AI is the potential for this loop to continue many times.

  4. The Elephant and the Goldfish Method 19:30

    This professional-grade workflow strategy uses two agents: the 'Elephant' (with long memory) to generate a comprehensive, detailed scope of work, and the 'Goldfish' (with no memory) to assess if the document is complete enough for autonomous execution. The process repeats until the Goldfish confirms no clarifying questions remain.

More digests on AI Agents

Technical details

  • Connectors and Model Context Protocol (MCP) 150s

    Connectors are access permissions that plug AI tools into external apps (e.g., Gmail, Outlook). Enabling a connector injects specific instructions and tool definitions (in JSON schema format) into the LLM's context window. The resulting structured text output is governed by the Model Context Protocol (MCP).

  • LLM Mechanism for Tool Calling 230s

    The LLM does not change its core function; it still performs next-token prediction. When acting, the LLM generates highly structured text (like software code) that functions as a call to a tool. A 'connector manager' reads this structured text, recognizes it, and dispatches the actual call to the enabled connector.

  • Security and Risk Mitigation 1800s

    Key security principles include 'least privilege access' (only granting necessary permissions) and rigorous attention to 'prompt injection' risks. The risk of an agent having overly broad permissions (e.g., permanent file deletion) must be carefully assessed.

Mentioned resources

Channel & topics

Watch on YouTube · Back to latest

This independent, AI-assisted summary is provided for commentary and informational purposes. It may contain errors or omit important context. Please watch the original video for the creator's complete presentation. Video, thumbnail, and related copyrights belong to their respective owners.