Skip to main content
AmigoFish

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

From Stanford Online · · 58 min

The player loads from YouTube only when you click. It uses YouTube's privacy-enhanced mode.

If the video does not play, the owner may have turned off embedding. Watch it on YouTube instead.

Watch on YouTube

Not rated yet

Description

Explore AI courses and programs from Stanford Online: https://stanford.io/4BYTekh

What happens when AI stops just writing and starts acting on your behalf? In this Stanford CS193T: Thinking with AI lecture recording, Senior Lecturer Cynthia Bailey explains how AI agents work and why prompt injection gets much worse once AI can take actions. She opens with connectors, the links that let AI read your email, calendar, or files and act on your behalf, and shows that nothing new is happening inside the model: it's the same next-token prediction behind every chatbot, occasionally generating specially structured text that triggers actions. From there she builds the vocabulary for autonomous work: the analyze, act, observe loop every agent runs on, the seven-part "anatomy" of a well-specified agent, and professional-grade agentic workflow techniques like "the elephant and the goldfish." The lecture closes by putting on a pessimistic security hat: for any agent you design, what's the worst that could happen, and whose permissions made it possible?

Key questions answered in this lecture recording: Q: What is the difference between generative AI and agentic AI? A: Bailey says agentic AI focuses on taking actions rather than only generating content, but it runs on the same next-token prediction: the LLM emits structured JSON text that a connector turns into an action.

Q: What is an AI connector? A: Connectors are access permissions that plug your AI tool into apps like Gmail or Outlook so it can pull in data or act on your behalf. Enabling one adds tool instructions to the context window, using the Model Context Protocol (MCP).

Q: What should you include when you define an AI agent? A: Bailey treats an agent spec as a detailed scope of work with seven parts: goal, context, tools, permissions, memory, actions, and stopping conditions. Stopping conditions matter because agents keep going until told to stop.

Q: What is the elephant and the goldfish method for AI agents? A: The elephant is a long interview-me chat that produces a 4 to 6 page scope of work. A fresh, memoryless goldfish reads only that document and reports whether agents could execute it without clarifying questions; repeat until no goldfish has questions.

Q: What does human in the loop mean in AI agents? A: It describes where in the agent loop a human is informed and can approve or block progress. Bailey argues the degree of human in the loop is the main difference between plain chat, connectors, and fully autonomous agents.

Q: How do you make AI agents safer? A: Bailey urges a "what's the worst that could happen" mindset and least privilege access: give agents only the permissions the task needs. She also flags prompt injection and adding human approval before irreversible actions like permanent deletes.

Chapters: 0:00 Intro: connectors, agents, and agent safety 2:20 What are AI connectors? 3:21 Email example: generative vs agentic AI 7:33 How AI tool calls work: next-token JSON 10:45 Connector instructions in the context window 16:41 Model Context Protocol (MCP) and MCP servers 18:05 Seven-part anatomy of an AI agent 23:34 Analyze, act, observe: the agent loop 27:38 Human in the loop and stopping conditions 29:34 The elephant and the goldfish method 38:22 Running the goldfish test loop 41:53 Agent safety: what's the worst that could happen? 53:14 Least privilege access for AI agents 55:21 Prompt injection via LinkedIn and web search

About the speaker: Cynthia Bailey is a Senior Lecturer in the Computer Science Department at Stanford University. In 2023-2024, she served as an AI Policy Fellow in the United States Senate through the American Association for the Advancement of Science (AAAS). Her scholarship focuses on computer science education, AI/machine learning, and the social impacts of technology, including creating courses such as Equity and Governance for Artificial Intelligence and Race and Gender in Silicon Valley. Her teaching and research awards include…

Back to Stanford Online · Report a problem