0% found this document useful (0 votes)
20 views13 pages

AI Agents First Principles Lesson Notes

The document outlines the fundamental principles for building AI agents, emphasizing the components of Large Language Models (LLM), memory, and tools operating in a continuous loop. It provides practical guidance on deploying AI agents securely, creating skills for specific tasks, and connecting tools using the Model Context Protocol (MCP). Additionally, it includes real-world applications and a roadmap for beginners to start building their own AI agents.

Uploaded by

kingsipun331
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views13 pages

AI Agents First Principles Lesson Notes

The document outlines the fundamental principles for building AI agents, emphasizing the components of Large Language Models (LLM), memory, and tools operating in a continuous loop. It provides practical guidance on deploying AI agents securely, creating skills for specific tasks, and connecting tools using the Model Context Protocol (MCP). Additionally, it includes real-world applications and a roadmap for beginners to start building their own AI agents.

Uploaded by

kingsipun331
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

AI Agents from First Principles

AI Agents from
First Principles
Build Your Own ClawdBot (OpenClaw)

Learn the Principles, Process, and Tools


to Build Your First AI Agent

Based on the 100xEngineers Masterclass Workshop


by Siddhant Goswami
Learning Outcomes
By the end of this lesson, you will be able to:

• Explain the three fundamental components of every AI agent

• Analyze how popular AI tools like OpenClaw, Cowork, and Browser Use are
architected

• Deploy AI agents safely using cloud-based solutions like DigitalOcean

• Implement security best practices for local agent deployments

• Create effective skills that teach AI agents to perform specific tasks

• Connect tools to AI agents

1. The First Principles of AI Agents


Every AI agent, regardless of how sophisticated it appears, is built on three
fundamental components working together in a loop. Understanding this simple
formula will help you analyze any AI tool and even build your own.

The Agent Formula

Core Principle
AI Agent = LLM + Memory + Tools (running in a loop). Tools change, but principles
don't. Those who understand why something works will always outpace those who
only know how to use it.

1. Large Language Model (LLM)

The LLM serves as the "brain" of your agent. It understands instructions, reasons about
tasks, and makes decisions. Popular options include:

• Claude (Opus 4.5) – Currently considered one of the best for agent tasks

• GPT-4 / ChatGPT

• Gemini

• Open source models (via Ollama or OpenRouter)


2. Memory

LLMs have limited context windows, meaning they can only "remember" a certain
amount of information at once. Memory systems solve this by storing information
externally so the agent doesn't forget its goals or previous actions.

Memory can be implemented using:

• SQL databases (Supabase, Postgresql)

• NoSQL databases

• Simple file storage like Google Drive

3. Tools

Tools are what give your agent the ability to take action in the real world. Without
tools, an LLM can only generate text. With tools, it can:

• Browse the web

• Send and read emails

• Manage calendars

• Read and write files

• Execute terminal commands

• Interact with APIs and services

The Loop: Bringing It All Together


The agent operates in a continuous loop:

1. Receive a goal (e.g., "Research the latest AI news and send me a summary")

2. Store the goal in memory so it doesn't forget what it's working on

3. Use the LLM to decide which tool to use next

4. Execute the tool and observe the result

5. Store results in memory for future reference

6. Repeat until the goal is achieved


2. Real-World AI Agents
Now that you understand the first principles, let's see how they apply to real AI tools
that have gained popularity.

1. Browser Use
Browser Use is an open-source project that allows AI agents to control web browsers
and automate online tasks.

Component Implementation

LLM ChatGPT or other models

Memory Database (SQL/NoSQL)

Tools Web Browser

Key Insight
The only difference from the basic formula is the specific tool – the browser. This
is why it can browse websites and automate online tasks.

2. Cowork (by Anthropic)


Cowork is a desktop application that can control your file system, organize files, open
browsers, and perform tasks on your behalf.

Component Implementation

LLM Claude Opus 4.5

Memory Database

Tools Browser + OS Terminal (full operating


system access)

Key Insight
By adding the OS Terminal as a tool, Cowork can do everything Browser Use can,
plus read/write files, download things, and organize your desktop.

3. OpenClaw (formerly ClawdBot)


OpenClaw is a personal AI assistant that can clear your inbox, send emails, manage
calendars, and check you in for flights all from WhatsApp or Telegram-like platforms.

Component Implementation

LLM Claude Opus 4.5

Memory SQLite (open-source database)

Tools Browser, OS Terminal, Email/Gmail, Google


Calendar, WhatsApp, Telegram

Key Insight
OpenClaw is fundamentally not different from any other agent – it just has more
tools connected, with a sophisticated loop enabling it to interface through
messaging platforms.

3. Safe Deployment Options

IMPORTANT SECURITY WARNING


Do NOT run AI agents on your personal machine with access to sensitive
information. There have been documented cases of data leaks, including API keys,
personal information, and conversation histories being exposed. Always use
isolated environments.

1. DigitalOcean (Recommended for Beginners)


DigitalOcean provides a pre-configured setup that doesn't compromise your security.
The agent runs on a cloud server, not your personal machine.

Step-by-Step Setup:
1. Go to DigitalOcean and create an account
2. Click on "Create Droplet"
3. Choose your region (select one closest to you)
4. Under "Choose Image," go to Marketplace
5. Find and select "Moldbot on Ubuntu"
6. Select Basic plan with Regular CPU ($24/month or $0.036/hour)
7. Create a strong password
8. Click "Create Droplet" and wait for setup

Cost: Pay only for hours used. Testing for 24 hours costs less than $1.

Specs: 4GB RAM, 80GB SSD – sufficient for running the orchestration layer.

2. Other Cloud Alternatives


• Oracle Cloud Free Tier – $0 forever, but requires technical expertise

• Emergent Labs – Recently launched OpenClaw support

• Cloudflare MoltWorker – Secure browser-based deployment

• Raspberry Pi/Dedicated PC – For advanced users who want a dedicated device

4. Security Checklist
If you decide to deploy an AI agent locally (not recommended for beginners), follow
these security measures:

Essential Security Steps


1. Change the default port: The default port (18789) is publicly known. Change it to
something unique.
2. Check gateway binding: If set to [Link], your agent is exposed to the internet.
Bind to localhost ([Link]) instead.
3. Set an authentication token: Always export a GATEWAY_TOKEN to require
authentication.
4. Use Docker containers: Isolate the agent in a container to limit potential damage
(sandboxing).
5. Create restricted folders: Only give the agent access to specific folders, not
your entire system.

Pro Tip
Use Twilio to get a separate phone number for your agent instead of using your
personal WhatsApp. This keeps your personal communications separate.

5. Creating Skills for Your AI Agent


Skills are the instructions that teach your AI agent how to perform specific tasks. Think
of them as Standard Operating Procedures (SOPs) that you would give to a human
employee.

The AI Employee Framework


An effective AI employee needs three things:

1. Knowledge – Information about the company, processes, and standards


2. Tools – Access to the systems needed to complete tasks
3. Agency – The ability to act independently and make decisions

What Makes a Good Skill?


A skill document should include:

• When to use this skill – Clear triggers for when the agent should apply this
knowledge

• Required inputs – What information the agent needs before starting

• Step-by-step instructions – Detailed process to follow

• Quality standards – How to evaluate if the output is good

• Examples – Sample inputs and expected outputs


Example Skills
Here are some common skills you might create:

• Slide deck creation – Guidelines for making presentations

• Email management – How to categorize and respond to emails

• Content writing – Tone, style, and format guidelines

• Research – How to find and summarize information

• UI/UX design – Design system guidelines and constraints

Pro Tip
Skills are portable! Once you create a good skill, you can use it across different AI
tools and platforms. The same instructions that work for one agent can often be
adapted for other agents from different platforms.
6. Connecting Tools with MCP
MCP (Model Context Protocol) is a standardized way to connect AI agents to tools.
Instead of building custom integrations for each tool, MCP provides a universal
connector.

How MCP Works


Think of MCP as a universal adapter. Just as USB-C can connect your phone to various
devices, MCP connects your AI agent to various tools:

• Google Drive – Read and write documents

• Gmail – Send and manage emails

• Google Calendar – Schedule and manage events

• Slack – Send messages and notifications

• And many more...

Using MCP with Claude


Claude has built-in MCP connectors that make it easy to add tools:

1. Click the "+" icon in Claude


2. Select "Connectors"
3. Choose the service you want to connect (e.g., Google Drive)
4. Authorize the connection
5. Start using the tool in your conversations

Key Insight
Each connector adds new capabilities without requiring you to build complex
integrations. MCP standardizes the interface so you can focus on what the agent
should do, not how to connect it.
7. Practical Applications & Success Stories
Understanding the first principles isn't just theoretical – it enables real-world impact.
Here are examples of what people have built using these concepts:

Case Study 1: Meta Ads Agent


A developer named Saumitra built an AI agent for Meta's ads platform that is now used
by 600 million users worldwide. The agent uses the same first principles: an LLM for
reasoning, memory for storing optimization data, and the Meta Ads platform as its tool.
Goal: maximize ROI for advertisers.

Case Study 2: LinkedIn Content Agent


Devyansh, a LinkedIn marketing expert, created an agent that writes content exactly
like him. By feeding the agent his past content (memory), teaching it his writing style
(skills), and giving it access to LinkedIn (tool), he scaled his expertise. This project led
to his acquisition by LinkedIn and the creation of Buzzli.

Case Study 3: Zeno - 100x Assistant


Using a Raspberry Pi (costing around $50-100), you can build a personal AI assistant
that runs 24/7. This setup uses Claude Opus 4.5 as the LLM, Google Drive as memory,
and tools like browser, email and calendar. It has generated 100+ research reports,
presentations, and it can do all of this without any security risks since 100xengineer’s
team built it from scratch using the same principles.
8. Getting Started Today
Here's a practical roadmap for beginners:

Week 1: Understand the Basics


• LLM + Memory + Tools in a loop

• Experiment with Claude Opus 4.5 to understand its capabilities

• Connect one tool (ex: Google Drive connector)

Week 2: Create Your First Skill


• Pick one task you do repeatedly

• Write detailed instructions for how to do it

• Test the skill with Claude and iterate until it works well

Week 3-4: Build a Simple Agent


• Set up a DigitalOcean droplet (safe option)

• Connect 2-3 tools relevant to your use case

• Create cron jobs for automated tasks

Free Resources to Get Started


Free LLM Access – [Link] offers free models for experimentation

• Local LLMs – Ollama lets you run open-source models on your machine

• Learning – Andrej Karpathy's videos for understanding LLMs from scratch

• Practice – Claude's built-in connectors & skills to start automating tasks


Conclusion
The AI landscape will continue to evolve rapidly. New tools will emerge, some will
become viral, and others will fade away. But the fundamentals remain constant:

Remember
AI Agent = LLM + Memory + Tools (running in a loop with a goal). Tools come and go,
but principles endure. People who understand why something works will always
outpace those who only know how to use it.

By understanding these principles, you can:

• Analyze any new AI tool and understand how it works

• Build your own agents without depending on external projects

• Make informed decisions about security and deployment

• Create skills that multiply your expertise

• Stay relevant regardless of which tools become popular


Appendix: Quick Reference

Agent Component Checklist

Component Options Recommended

LLM Claude, GPT-4, Gemini, Claude Opus 4.5 for


Open Source agents

Memory SQL, NoSQL, Supabase, Supabase


Files

Tools Browser, Terminal, Email, Start with MCP


Calendar, etc. connectors

Deployment Cloud, Local, Raspberry Pi DigitalOcean for beginners

Key Terms Glossary


LLM (Large Language Model): The AI brain that understands and generates text

Context Window: The amount of text an LLM can "remember" at once

MCP (Model Context Protocol): A standard way to connect AI agents to tools

Skill: Instructions that teach an agent how to perform specific tasks

Cron Job: A scheduled task that runs automatically at specified times

Sandboxing: Isolating an agent to limit potential damage

Droplet: DigitalOcean's term for a virtual server

API Key: A secret code that allows access to a service

You might also like