What is an Agent?

Simple definition

System prompt, Tools (MCP), LLM

Properties of an Agent

  • An agent is stateful, tool-using, and iterative
  • Perceives: data input (queries, tool results, memory)
  • Reasons: about current state and goal using LLM as cognitive core
  • Plans and executes: sequence of actions, choosing tools autonomously
  • Adapts:
  • Persists until done:

Evolution of AI Agents

How can we increase autonomy, tools, and the ability to execute under-specified user tasks

The Agent Loop

The number of loops is oftentimes hardcoded

  1. Build Prompt
  2. Call LLM: two outcomes - model wants tools or end turn (final answer ready)
  3. Execute tools: Each tool
  4. Loop or stop: append tool call and tool results to memory

MCP Protocol & Tools

Tooling

  • Tools must be discovered dynamically - hardcoding defeats purpose of MCP
  • Do not over describe tools
  • PlanAgent can narrow the number of allowed MCP tools per task
  • LangFlow does not allow you to limit tools

Prompt Engineering for Agents

  • Capital words are like “shouting”
  • Tool awareness: describe when and when not to use tools
  • Iteration guidance: tell the agent when to stop
  • Error handling: explicit recovery if something fails
  • Scope control: effective system prompt - PromptTransformer reduces a 3K system prompt to 1K for routing-only calls

Goal Persistance

  • Persist goals through memory, even through multiple iterations

Model Context Protocol (MCP)

  • Standardized protocol for connecting LLMs to external systems (databases, APIs, files)
  • Do not specify number of tools
  • Two pieces of text: the description of when to call the tool and the input schema which is a JSON for the LLM to construct valid arguments
    • The agent will never see the server code

MCP Protocol Layers

  • Application: tool list / discovery, resources
  • Response: One JSON-RPC exchange for every tool
    • Specify success and error response
  • Transport: HTTP / SSE / Streamable HTTP abstracted behind the MCPTransport ABC
    • ABC abstracts different wire protocols

MCP Best Practices

  • Pool connections: singleton manager shared across all agents
  • Cache tool lists: MCP tools cache persists within a session, tools rarely change at runtime
  • Filter per task: PlanAgent analyzes query and passes only relevant tool names
  • Graceful degradation: tool execution catches every exception and returns {error, content} never raises
  • Two-layer permissions
  • Health monitoring

AI Skills

What is an AI Skill

SKILL.md files inject domain expertise which are retrieval-augmented knowledge for specialized agents

  • A skill is packaged expertise - A directory containing one SKILL.md file plus optional scripts and resources as references
  • It is content to be read not a function
  • Skills give judgement about when, why, and which pattern to apply
    • Capability + Expertise

Skill Lifecycle

  • Define, load (phase 1), match, invoke (phase 2)

Skill Matching Pipeline

  • User query
  • Dual search
  • Combine - 70% semantic + 30% keyword
  • Top k

Context & Memory

What is Agent Memory?

  • Memory is not the same as the context window