🤖

Building an AI Agent

Building an AI Agent


An AI agent is different from an automation.

Automations follow a predefined sequence that does something when a trigger is called.

An agent is capable of understanding and reasoning. It's a digital employee that can think, remember, and act.
notion image

3 Key Components of an agent


1. Brain(LLM) - handles the reasoning, planning and language generation.
For e.g Open AI, Claude
2. Memory - gives the agent ability to remember past intereactions to make better decisions.
3. Tools - How the agent interacts with outside world
1. Retieve data - searching the web
2. Taking action - sending an email, update database or create event
3. Orchestration - call other agents, trigger a workflow or chaining actions


With agents, you have single-agent system or multi-agent system

Single agent system


The user prompts, the agent reads the prompt, then gives the solution.

Multi agent system

 
Multi-agent systems have more struture. You might have different agents doing different tasks. For example, you might have a sales agent, a marketing agent and a customer support agent. Then you might also have one supervising agent who handles the prompt and decides who to send the prompt to.

Setting Guardrails

  • Identify risks and edge cases in your specific use case
  • Optimize for security purpose and user experience
  • Adjust guardrails over time.

    Asides from using a a AI agent builder like n8n to build these automations, you need to define agent prompts.

Agent Prompt

 
  • Role - What kind of assistant it is?
  • Ask - What is it trying to accomplish
  • Input - What data does it have access to?
  • Tools - What actions can it take?
  • Constraints - What rules should it follow?

By leveraging tools like ChatGPT, you can ask it to write a prompt that you can copy to *specific* agents.
This prompt then gives sets the direction that the agent should follow. It also what makes the agent truly yours.
Some example of really powerful agents that you can build is like
  • A personal assistant that tells you the weather
  • A sales agent
  • A social media agent that copywrites and posts content.
  • a customer support agent answering messages from Whatsapp from the company knowledge base
  • a travel planner agent that recommends
  • A gym coach that recommends workouts based on your habits
  • A digital you that you own rights to.
Users can also ask the agent in natural human language when it has a brain that it connects to.

Best practices
  1. Build the simplest thing that works - If one agent can do the job, just use one. If an automation works better, then just use an automation.
  1. Follow your AI Agents build just like a company organizational structure.