AiTechWorlds
AiTechWorlds
Core concepts behind AI agents, tools, memory, planning, and multi-agent systems.
An AI Agent is an LLM-powered system that can:
1. Reason about a goal
2. Plan a sequence of actions
3. Use tools to take actions (web search, code execution, APIs)
4. Observe results and adjust
5. Loop until the goal is achieved
Goal β Think β Act β Observe β Think β Act β ... β DoneFunctions the agent can call to interact with the world:
def search_web(query: str) -> str:
"""Search the internet for information"""
return results
def run_python(code: str) -> str:
"""Execute Python code and return output"""
return output| Type | Description | Example |
|---|---|---|
| Short-term | Current conversation context | Chat history |
| Long-term | Persistent storage | Vector database |
| Episodic | Past experiences | Previous tasks |
| Semantic | World knowledge | LLM weights |
Question: What is the population of Tokyo?
Thought: I need to search for the current population of Tokyo.
Action: search_web("Tokyo population 2024")
Observation: Tokyo's population is approximately 13.9 million.
Thought: I have the answer.
Answer: Tokyo's population is approximately 13.9 million people.from langchain_openai import ChatOpenAI
from langchain.agents import create_react_agent, AgentExecutor
from langchain_community.tools import DuckDuckGoSearchRun
from langchain import hub
# Setup
llm = ChatOpenAI(model="gpt-4o", temperature=0)
tools = [DuckDuckGoSearchRun()]
prompt = hub.pull("hwchase17/react")
# Create agent
agent = create_react_agent(llm, tools, prompt)
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
# Run
result = agent_executor.invoke({"input": "What is the latest news about AI?"})Multiple specialized agents collaborate:
User Request
β
Orchestrator Agent
/ | \
Research Code Writer
Agent Agent Agent
\ | /
Final Responsefrom langgraph.graph import StateGraph, END
from typing import TypedDict
class AgentState(TypedDict):
messages: list
next: str
def research_node(state: AgentState):
return {"messages": state["messages"] + ["research done"]}
def write_node(state: AgentState):
return {"messages": state["messages"] + ["writing done"]}
# Build graph
workflow = StateGraph(AgentState)
workflow.add_node("research", research_node)
workflow.add_node("write", write_node)
workflow.add_edge("research", "write")
workflow.add_edge("write", END)
workflow.set_entry_point("research")
app = workflow.compile()from openai import OpenAI
client = OpenAI()
tools = [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather for a city",
"parameters": {
"type": "object",
"properties": {
"city": {"type": "string", "description": "City name"}
},
"required": ["city"]
}
}
}
]
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "What's the weather in Tokyo?"}],
tools=tools
)| Metric | Description |
|---|---|
| Task Completion Rate | % of tasks successfully completed |
| Steps to Complete | Average actions needed |
| Hallucination Rate | % of false tool calls |
| Latency | Time to complete task |
| Cost | Token usage per task |
Advertisement
Get more notes like this daily on Telegram!
Free study notes, cheat sheets & AI tips
Last reviewed on June 13, 2026 by the AiTechWorlds Notes Team. Free cheat sheet β no signup required.
Advertisement
Join AiTechWorlds on Telegram and get daily AI tips, prompt engineering templates, coding resources, and exclusive content β 100% free!
No spam. Leave anytime.