π§© Agent Components
Memory, prompting, tools, resources, and agentic patterns.
Components of an AI agent
Memory
Short-term = current context (recent messages, tool results). Long-term = vector store or DB for facts and preferences across sessions.
Example: Agent remembers 'user asked for London weather' in this turn; long-term stores 'user prefers Celsius' for future turns.
Prompting
System prompt (role, rules), user instructions, and optionally few-shot examples. This sets how the agent reasons and what it can do.
Example: System: 'You are a travel assistant. Always cite sources.' User: 'Best time to visit Japan?'
Tools
Functions the agent can call: search, calculator, run code, call APIs (e.g. weather, calendar). The model outputs a tool call; the app runs it and returns the result.
Example: Model returns get_weather(city='Paris'); app calls API, gets 18Β°C; result is sent back so the model can say 'Itβs 18Β°C in Paris.'
Resources
Read-only data the agent can access: files, docs, databases. Often exposed via RAG (retrieve chunks) or MCP resources.
Example: Agent needs the company policy doc; app retrieves relevant chunks from a vector DB and adds them to the prompt.
Common agentic patterns
- π
ReAct
Reason + Act in a loop (thought β action β observation)
- π
Plan-and-Execute
Plan steps first, then execute each step
- π§
Tool-augmented
Single call with tools; model chooses which to use