Agentology · Knowledge of agents

of an answer,
to an action

Know your agent from the inside; The target, the tool, the memory and the loop that checks the result. This is the starting point of your learning path in Nima creations.

Discover the path
Nima’s creations Agentology

Why try this product?

See your agent from the inside, not from the definition.

Agentology is a 10-stop path that, instead of memorizing jargon, exposes how agents work: how they make decisions, call tools, recover from errors, and collaborate.

  • 6 interactive simulatorsRun your own Agent Ring, RAG, Multi-Agent System, Token Calculator and Security Lab.
  • Glossary + 20 question testRead each concept with an example and measure yourself at the end.
  • Suggested path based on your problemFirst, determine what your problems are; Then enter the repair workshop.
Full access, free

Do you want to learn more and differently?

First, register your profile and email address here to get full access to this educational content, simulators, and games — once for all builds.

No spam; Only the news of new creations and courses. Do you have an account? enter

First, know the problem.
Then make an agent.

Not all jobs need an agent. A clear request may be resolved with an answer; A fixed process with workflow; And an open problem with a cycle of decision and tools.

Agentology is part of Nima's creations: short lessons, touchable simulators, and a path from prompts to controlling system behavior.

For your problem, which path?

Choose a scenario.

A clear prompt is enough.

When you just want a text of the available information, start with the specified command and evaluate the output.

Prompt engineering workshop →

Continue your path with practice.

Igentology, step by step

13 main lessons and Igentology simulators. Open each lesson and go through the examples. The data and costs of the simulators are educational and not the daily price of the services.

Why is the agent you are building not working?

There is a repeating pattern: you watch a tutorial, build the agent, the first test works great, but on the second or third task everything falls apart! The agent is either going around in an endless loop, or hallucinating, or generating a hefty bill. The reason is not that the code is wrong; Not knowing is that What exactly is going on under the hood of the agent?

The first trap

Runaway Loop

The stopping condition of the agent is weak. Instead of solving the problem, the model spins endlessly and consumes tokens.

The second trap

Hallucination

You have assumed that the model knows your private information, while the unprovided private information is not necessarily in the input or available tools of the model!

The third trap

Token Inflation

At each round of the loop, all previous history is fed back to the model, and the cumulative input consumption grows faster than the number of rounds.

From neural network to linguistic model (LLM)

Traditional programming means writing precise rules: "if this, then do that". Artificial intelligence reversed this relationship; Instead of a rule, you show thousands of examples so that the machine can make its own pattern. In 2017 architecture Transformer with mechanism Attention It was introduced that it processes the whole words of the sentence at once.

📌 The basic difference between traditional programming and AI:

In traditional code, any unexpected input crashes the system. In the linguistic model, the output is a "high-quality statistical prediction for the next token" based on the word's attention weight.

⚡ What is the Attention mechanism?

The old models went forward word for word. Transformer looks at the whole sentence at once and calculates how dependent each word is on other words.

The vital trinity: chatbot, workflow or agent?

The biggest misunderstanding in the world of artificial intelligence is here! Most of the tasks that people create agents for can be solved much cheaper, faster and 100% more predictable with a simple workflow.

Level 1: Static conversation

Chatbot

He waits for the question, answers, that's it. Can't do anything outside the chat box.

  • Suitable for answering common and simple questions
  • Very low cost and instant response speed
  • It is not possible to do practical work and change the file or database
  • There is no multi-stage decision-making and trial and error
Level 2: definitive path

Workflow

You have already determined the path step by step (first A, then B, then C). The model is not a route decision maker.

  • 100% predictable and without logical error
  • Controlled and fully optimized token cost
  • Very fast and stable in enterprise environments
  • It is not flexible for uncertain and unknown scenarios

🧪 Diagnostic tool: Which one does your project really need?

Click on the options to see the offer

Choosing between chatbot, workflow and agent is the biggest decision in cost optimization and sustainability of your product.

Agent Loop - The beating heart

The heart of every agent is a 4-step loop: thinks, act, observes the result and Decide/Check Stop. This cycle is repeated until the job is done.

🔄
Agent Loop step-by-step execution simulator
Choose the desired scenario from the following menu:
🧠
The first stage
1. Think
The model decides what action is required
⚡
The second stage
2. Act
Generating the tool call command (Tool Call)
👁️
The third stage
3. Observe
Get real data from the tool
🎯
The fourth stage
4. decide
Checking the end condition or repeating the loop
while not done: action = model.decide(history) #1. Thinking and decision making result = execute(action) #2. Action and implementation of the tool history.append(result) #3. View output done = check_stop(history) #4. Did we reach the goal?
Tools and Function Calling

The agent does not get anywhere by thinking alone; Must be able to act in the real world (search the web, read a database, run code, send email). But how does a model that produces only text call the tool? Answer: Function Calling in JSON format.

📦 Standard model output format (JSON):

does not "execute" the instrument model; The model only writes a JSON structure. Your external program reads it, executes it, and returns the result:

{ "tool": "get_weather", "input": { "city": "Tehran", "date": "tomorrow" } }

⚠️ The golden rule of the number of tools:

As the number of tools available to the model increases, the probability of model confusion and wrong tool selection increases. Always start small (1-3 essential tools).

Memory, context window and token economy

Linguistic models by nature Stateless are Every time you talk to them, it's like they just woke up! Therefore, the entire history must be resubmitted. In Agents, each round of the loop enlarges the history, and the cost of tokens increases as the history accumulates.

🎛️ Change the agent execution parameters:

Number of Loop Iterations: 5 rounds
Volume of the initial prompt and instructions (System Prompt): 1,000 tokens
The average return data of each tool (Tool Result Tokens): 500 tokens
Model selection:
The total consumption of cycle tokens
0 tokens
Estimated cost of this task: $0.00
Breakdown of token consumption share:
🔵 Basic prompt Repeating history 🟢 Tools
Calculating the comparison...
Embedding, vector database and RAG

How to find only the relevant part among thousands of pages of information? Sentences are converted into numbers (vector / Embedding). Sentences with close meaning (such as "the cat slept on the carpet" and "Peesi da lee on the carpet"), their distance in the vector space is close to zero!

semantic map of vectors (Semantic Embedding Space) Semantic Euclidean distance

🔍 Semantic search and retrieval:

User question: "Domestic kitten sleeping"
Semantic similarity of cosine: 96.8%
The document retrieved from the database:
...
The final prompt injected into the model (RAG Prompt):
...
MCP — Standard Tools Port (Model Context Protocol)

Previously, to connect each tool (Gmail, Drive, Postgres) you had to write specific code for the same model. Protocol MCP It is a universal open standard so that any tool server written once can be used by all agents and models without code changes.

Before MCP

Asymmetric cable connections

A recode for OpenAI, another for Claude and another for LangChain for each tool!

with MCP standard

Universal USB port

Write the MCP server for your GitHub or database once; All clients (Cursor, Claude Desktop, Antigravity) connect instantly.

Double layer structure

MCP Client & Server

The client sends the prompt, the MCP server returns the list of methods and resources (Resources & Tools) by default.

The four main architectures of genetics
Architecture 1

ReAct

Reasoning + Acting. Suitable for short and quick tasks.

Architecture 2

Plan & Execute

First, he writes the complete checklist of the route and then executes it one by one so as not to deviate from the goal.

Architecture 3

Reflection

Production ⟵ review ⟵ automatic rewriting to bring the quality of text and code to the highest level.

Architecture 4

Dynamic Routing

Intelligent routing of the user's request to the relevant agent or specialist workflow.

Multi-Agent Systems

When you have an agent with 20 tools and a 10-page manual, you're asking one person to be versatile, and the result is poor. Solution: role specialization with several centralized agents.

👥 Selection of team scenario:

Frameworks and SDKs
Independent open source frameworks

LangGraph and CrewAI

LangGraph: An option for when the workflow has branching, complex conditions, and stop/resume capabilities.
CrewAI: Focused on multi-agent systems with role segregation and automated team collaboration.

Official SDKs of companies

Anthropic, Google GenAI & OpenAI

provide interfaces to use the capabilities of the constructor model; But be careful Vendor Lock-in Be so that you can easily move the models in the future.

Security, Prompt Injection and Guardrails

When the chatbot makes a mistake, you see wrong text and get rejected; But when the agent makes a mistake, a file is deleted, code is executed, or data is leaked!

Agent security guardrails (Guardrails & Sandbox):
Change the security switch to see the difference in agent behavior
Active defense layers:

...

...

// Malicious input detected:
...
...
...
Real applications in industry
💻

Automated coding and testing

An agent that writes code, executes unit tests, debugs in case of errors, and commits when the tests pass.

📬

Email triage and meetings

Categorize incoming messages, extract meeting tasks, and draft responses in the human approval queue.

📊

Analysis of financial documents and RAG

Reading hundreds of pages of annual financial reports, crunching the numbers and extracting opportunities and risks by checking the accuracy of the output.

Additional study: Agent and Workflow Patterns — Anthropic

From learning to implementation

Your own problem
Make it a project.

A conversation with Nima