Principles of Building Agents

27 Jun 2026 - 27 Jun 2026
Open in Logseq
    • book by Sam Bhagwat of Mastra
    • focused on using LLMs, not building/training them.
    • Pretty basic so I'm not getting a lot out of it. Some tricks and I need to be more hands-on with Mastra
    • Prompting

      • zero, one, many shot
      • seed crystal – ask LLM to generate prompt
        • Typically you should ask the same model that you’ll be prompting: Claude is best at generating prompts for Claude, gpt-4o for gpt-4o, etc.
        • Is this true? Why?
    • Building an Agent

      • Tool mindset
    • Hierarchical memory is a fancy way of saying to use recent messages along with relevant long-term memories
    • RAG tricks

      • "Memory Processors" that cut down on context
    • Dynamic Agenrs. dont quite see the point of this one.
    • Guardrails, prompt injection
    • Cloud-based web search APIs. There are a few web search APIs that have become popular for LLMs to use, including Exa, Browserbase, and Tavily.
      • and a bunch of others, prob many new ones since then
    • an “agentic iPaas” (integration-platform-as-a-service). we’ve seen folks be happy with Composio, Pipedream, and Apify.
    • Graph-based workflows

      • Yes obvious good idea which I havent been thinking of for some reason. Maybe it conflicts with agent metaphor in my head?
      • Mastra has a functional API for defining these, so that's yet another metaphor (but technically fine).
      • unclear from the text if this builds some structure or executes something (prob the former)
      • human-in-the-loop steps with suspend/resume (bad metaphor, I wouldnt' do it that way, a human and agent should be on equal ontological footing)
    • Streaming

      • Something I've totally ignored, but realize you need it to have a framework. Should go in ellellem if it isn't there .
    • Observability and Tracing

      • The standard format for traces is known as OpenTelemetry, or OTel for short.
      • Wow had no idea that was a thing, good to know
    • RAG

      • stuff I know<
      • Mastra supports chunking pipeline which surprised me a bit
      • Agentic RAG – with tools – not sure I get it
      • ReAG – reasoning RAG
    • Multi-agent systems

      • image.png
      • Man is that all it takes? I'm overthinking things.
      • MA Patterns
        • Agent Supervisor
      • A2A protocol (should be more familar)
    • Evals

      • So you just instantiate HallucinationMetric? How does that work?
    • Deployment / UI

      • some standard AI-focused UI frameworks: Assistant UI, Copilot Kit, and Vercel’s AI SDK UI
      • Deployment and scaling stuff that I admit I haven't thought about much so its a good overview
    • Multimedia

      • ditto
    • Code generation