AI Agents
A chat model answers your question and stops. An agent takes a goal, picks its own next step, uses a tool, looks at the result, and goes on until the goal is met. For a tester, that is the difference between "explain this stack trace" and "find why the login tests fail, fix it, and show me the green run".
6 min read6 মিনিটে পড়া যায় · 7 sections7টি সেকশন · 10 sources10টি সোর্স · updated Nov 2026আপডেট: Nov 2026
The agent loop, turn by turnএজেন্ট লুপ, টার্ন ধরে ধরে
Count turns as a model calls tools until it gives a plain answer, and hit a turn cap.মডেল টুল কল করতে করতে সাদামাটা উত্তর দেওয়া পর্যন্ত টার্ন গুনুন, আর টার্ন সীমায় ঠেকে যান।
You’ll learnআপনি শিখবেন
- How the goal, tool call and result cycle worksলক্ষ্য, টুল কল ও ফলাফলের চক্র কীভাবে চলে
- What one turn isএক টার্ন কী
- The loop ends on an answer with no tool callটুল কল ছাড়া উত্তরে লুপ শেষ হয়
- A hook can block a tool callহুক একটা টুল কল আটকাতে পারে
- How max_turns cuts the loop shortmax_turns কীভাবে লুপ থামায়
In plain words
An AI agent is a program that gets a task done by choosing its own next steps and using tools, for example tools that open files, run shell commands, or change code Source 2সোর্স 2. A model with no tools can only reply with text. With tools, it can read your code, edit files, run commands, and search the web Source 1সোর্স 1.
The idea comes from research such as ReAct (2022). In ReAct, a language model writes reasoning steps and actions in turns, and the actions let it work with outside sources such as a knowledge base Source 5সোর্স 5.
The agent that most testers meet first is Claude Code. It is an agentic assistant that runs in the terminal Source 1সোর্স 1. You give it a goal such as "fix the failing tests", and it decides which commands to run and which files to read Source 1সোর্স 1. The site's How Claude Code works page goes deeper.
সহজ English
An AI agent is a program that finishes a task on its own. It plans its own steps. It calls tools, for example tools that open files, run shell commands, or change code Source 2সোর্স 2. A model with no tools can only reply with text. With tools, it can read your code, edit files, run commands, and search the web Source 1সোর্স 1.
The idea comes from research such as ReAct (2022). In ReAct, a language model writes a reasoning step, then an action, then another reasoning step, and so on. The actions let it work with outside sources, such as a knowledge base Source 5সোর্স 5.
Most testers meet Claude Code first. It is an agent that runs in the terminal Source 1সোর্স 1. You give it a goal, such as "fix the failing tests". It decides which commands to run and which files to read Source 1সোর্স 1.
বাংলা ব্যাখ্যা
AI agent হলো এমন একটা প্রোগ্রাম, যে নিজের ধাপ নিজে প্ল্যান করে এবং টুল (tool) কল করে একটা কাজ শেষ করে। যেমন ফাইল খোলা, শেল কমান্ড চালানো বা কোড বদলানোর টুল Source 2সোর্স 2। টুল ছাড়া একটা মডেল শুধু টেক্সটে উত্তর দিতে পারে। টুল থাকলে সে আপনার কোড পড়তে, ফাইল এডিট করতে, কমান্ড চালাতে এবং ওয়েবে সার্চ করতে পারে Source 1সোর্স 1।
ধারণাটা এসেছে ReAct (2022)-এর মতো গবেষণা থেকে। ReAct-এ একটা ল্যাঙ্গুয়েজ মডেল পালা করে যুক্তির ধাপ (reasoning) আর অ্যাকশন (action) লেখে। অ্যাকশনগুলো তাকে বাইরের সোর্সের সাথে কাজ করতে দেয়, যেমন একটা knowledge base Source 5সোর্স 5।
বেশিরভাগ টেস্টার প্রথমে Claude Code-এর সাথে পরিচিত হন। এটা টার্মিনালে চলা একটা এজেন্ট Source 1সোর্স 1। আপনি একটা লক্ষ্য দেন, যেমন "fix the failing tests"। কোন কমান্ড চালাবে আর কোন ফাইল পড়বে, তা সে নিজে ঠিক করে Source 1সোর্স 1।
How it works
The Claude Code loop has three phases: gather context, then take action, then verify results. It uses tools in all three Source 1সোর্স 1. The Agent SDK documents the same loop in detail Source 3সোর্স 3:
- Claude gets your prompt, the system prompt, the tool definitions, and the conversation so far.
- Claude answers with text, with one or more tool calls, or with both.
- The SDK runs each tool and sends the results back to Claude.
- Steps 2 and 3 repeat. Each full cycle is one turn. The loop ends when Claude gives a response with no tool calls.
goal --> [ model decides ] --> tool call --> [ tool runs ] --> result
^ |
+--------------------------------------------------+
(repeat until the answer has no tool call: done)At the API level, a tool you define is a client tool. Claude stops with stop_reason: "tool_use" and a tool_use block, your code runs the tool, and you send back a tool_result. A server tool, such as web search, runs on Anthropic's side Source 4সোর্স 4.
You keep control of the loop:
- Limits.
max_turnscaps the number of turns (each turn with tool calls counts, and the final text-only reply needs one more) andmax_budget_usdcaps the spend. Both have no limit by default Source 3সোর্স 3. - Tool rules.
allowed_toolsapproves listed tools with no prompt,disallowed_toolsblocks tools, and a rule such asBash(npm *)allows only some commands Source 3সোর্স 3. - Hooks. A
PreToolUsehook can reject a tool call before it runs Source 3সোর্স 3. See Hooks. - Subagents. A subagent has its own context window, its own system prompt, and its own tool access Source 6সোর্স 6.
- You. You can interrupt at any point and steer the agent Source 1সোর্স 1.
সহজ English
Claude Code works in three phases. It gathers context. It takes action. It verifies the results. It uses tools in all three phases Source 1সোর্স 1. The Agent SDK describes the same loop in more detail Source 3সোর্স 3:
- Claude gets your prompt, the system prompt, the tool definitions, and the conversation so far.
- Claude answers with text, with one or more tool calls, or with both.
- The SDK runs each tool and sends the results back to Claude.
- Steps 2 and 3 repeat. One full cycle is one turn. The loop ends when Claude gives an answer with no tool call.
In short: the goal goes to the model, the model asks for a tool, the tool runs, and the result goes back to the model. This repeats until the answer has no tool call.
In the API, a tool that you define is a client tool. Claude stops with stop_reason: "tool_use" and a tool_use block. Your code runs the tool. Then you send back a tool_result. A server tool, such as web search, runs on Anthropic's side Source 4সোর্স 4.
You keep control of the loop:
- Limits.
max_turnscaps the number of turns. Each turn that calls tools counts, and the final text-only answer needs one more turn.max_budget_usdcaps the spend. By default, neither has a limit Source 3সোর্স 3. - Tool rules.
allowed_toolslets listed tools run with no question.disallowed_toolsblocks tools. A rule such asBash(npm *)allows only some commands Source 3সোর্স 3. - Hooks. A
PreToolUsehook can stop a tool call before it runs Source 3সোর্স 3. - Subagents. A subagent has its own context window, its own system prompt, and its own tools Source 6সোর্স 6.
- You. You can stop the agent at any point and give it a new direction Source 1সোর্স 1.
বাংলা ব্যাখ্যা
Claude Code তিনটা ধাপে কাজ করে: কনটেক্সট জোগাড় করা (gather context), কাজ করা (take action) এবং ফলাফল যাচাই করা (verify results)। তিনটা ধাপেই সে টুল ব্যবহার করে Source 1সোর্স 1। Agent SDK একই লুপ (loop) আরও বিস্তারিত বলে Source 3সোর্স 3:
- Claude আপনার প্রম্পট, system prompt, টুলের সংজ্ঞা (tool definitions) এবং এখন পর্যন্ত কথোপকথন পায়।
- Claude টেক্সট দিয়ে, এক বা একাধিক টুল কল দিয়ে, অথবা দুটো দিয়েই উত্তর দেয়।
- SDK প্রতিটা টুল চালায় এবং ফলাফল Claude-কে ফেরত পাঠায়।
- ধাপ 2 আর 3 বারবার চলে। একটা পুরো চক্রকে বলে এক turn। Claude যখন টুল কল ছাড়া উত্তর দেয়, লুপ শেষ হয়।
সংক্ষেপে: লক্ষ্য মডেলের কাছে যায়, মডেল একটা টুল চায়, টুল চলে, ফলাফল আবার মডেলের কাছে যায়। উত্তরে টুল কল না থাকা পর্যন্ত এটা চলতে থাকে।
API-তে আপনার বানানো টুলকে বলে client tool। Claude stop_reason: "tool_use" আর একটা tool_use ব্লক দিয়ে থামে। আপনার কোড টুলটা চালায়, তারপর আপনি একটা tool_result ফেরত পাঠান। Server tool, যেমন web search, Anthropic-এর দিকে চলে Source 4সোর্স 4।
লুপের নিয়ন্ত্রণ আপনার হাতে থাকে:
- সীমা।
max_turnsturn-এর সংখ্যা বেঁধে দেয় (টুল কল থাকা প্রতিটা turn গোনা হয়, আর শেষের টেক্সট-মাত্র উত্তরের জন্য আরও একটা turn লাগে)।max_budget_usdখরচ বেঁধে দেয়। ডিফল্টভাবে কোনোটারই সীমা নেই Source 3সোর্স 3। - টুলের নিয়ম।
allowed_toolsতালিকার টুলগুলো কোনো প্রশ্ন ছাড়া চলতে দেয়।disallowed_toolsটুল বন্ধ করে।Bash(npm *)-এর মতো নিয়ম শুধু কিছু কমান্ড চলতে দেয় Source 3সোর্স 3। - Hooks। একটা
PreToolUsehook কোনো টুল কল চলার আগেই আটকাতে পারে Source 3সোর্স 3। - Subagents। একটা subagent-এর নিজের context window, নিজের system prompt আর নিজের টুল থাকে Source 6সোর্স 6।
- আপনি। আপনি যেকোনো সময় এজেন্টকে থামিয়ে নতুন দিক দেখাতে পারেন Source 1সোর্স 1।
How a tester uses it
Triage a failing test. Ask the agent to fix the failing tests. The Claude Code docs show the typical steps: run the suite, read the error, search for the source, read it, edit it, and run the tests again Source 1সোর্স 1. You review the diff and the final test output.
Explore the app in a real browser. Playwright MCP gives an agent browser tools. It reads the page as structured data from the accessibility tree, so it needs no vision model Source 7সোর্স 7. You can ask the agent to walk through a signup flow on https://staging.example.com and list what looks wrong. The Playwright page and the MCP Connectors skill go deeper.
Run the agent in CI. The same loop runs without a person: call claude -p and add --output-format json Source 2সোর্স 2. See Headless mode and GitHub Actions.
Split a big job. Give a review job to a subagent. Its tool calls stay out of your main context, and you get back a summary Source 1সোর্স 1. See Subagents.
Tutorial advice
This is the tutorial's own advice. Give every agent task a check that a machine can run, such as npm test or one Playwright spec. Ask for the exact command and its output at the end. Start in a test environment, never on production data.
সহজ English
Triage a failing test. Ask the agent to fix the failing tests. The Claude Code docs show the usual steps. It runs the tests. It reads the error. It searches for the code. It reads the code and edits it. Then it runs the tests again Source 1সোর্স 1. You check the change and the last test output.
Explore the app in a real browser. Playwright MCP gives an agent browser tools. It reads the page as structured data, so it needs no vision model Source 7সোর্স 7. You can ask the agent to go through a signup flow on https://staging.example.com and list what looks wrong.
Run the agent in CI. The same loop can run with no person watching. You call claude -p and add --output-format json Source 2সোর্স 2.
Split a big job. Give a review job to a subagent. Its tool calls stay out of your main conversation. You get back a short summary Source 1সোর্স 1.
This is the tutorial's own advice. Give every agent task a check that a machine can run, such as npm test or one Playwright spec. Ask for the exact command and its output at the end. Start in a test environment, never on production data.
বাংলা ব্যাখ্যা
ফেইল করা টেস্ট খুঁজে দেখা (triage)। এজেন্টকে ফেইল করা টেস্টগুলো ঠিক করতে বলুন। Claude Code ডকস সাধারণ ধাপগুলো দেখায়: টেস্ট চালানো, এরর পড়া, সোর্স খোঁজা, সেটা পড়া, এডিট করা, তারপর আবার টেস্ট চালানো Source 1সোর্স 1। আপনি পরিবর্তন (diff) আর শেষ টেস্ট আউটপুট দেখে নিন।
আসল ব্রাউজারে অ্যাপ ঘুরে দেখা। Playwright MCP একটা এজেন্টকে ব্রাউজারের টুল দেয়। সে পেজটা structured data হিসেবে পড়ে, তাই কোনো vision model লাগে না Source 7সোর্স 7। আপনি এজেন্টকে https://staging.example.com-এ একটা signup flow পার হয়ে কী কী ভুল লাগছে তার তালিকা দিতে বলতে পারেন।
CI-তে এজেন্ট চালানো। একই লুপ কোনো মানুষ ছাড়াও চলতে পারে। CLI-কে -p আর --output-format json দিয়ে চালান Source 2সোর্স 2।
বড় কাজ ভাগ করা। একটা রিভিউয়ের কাজ একটা subagent-কে দিন। তার টুল কলগুলো আপনার মূল কথোপকথনের বাইরে থাকে। আপনি একটা সংক্ষিপ্ত সারাংশ পান Source 1সোর্স 1।
এটা টিউটোরিয়ালের নিজের পরামর্শ। প্রতিটা এজেন্টের কাজে এমন একটা চেক দিন যা মেশিন চালাতে পারে, যেমন npm test বা একটা Playwright spec। শেষে ঠিক কোন কমান্ড চলেছে আর তার আউটপুট চেয়ে নিন। টেস্ট এনভায়রনমেন্টে শুরু করুন, কখনো production ডেটায় নয়।
Tools to try
| Tool | What it does | One fact |
|---|---|---|
| Claude Code | An agent in your terminal, IDE, or CI | It works in three phases: gather context, take action, verify results Source 1সোর্স 1 |
| Claude Agent SDK | The Claude Code loop as a library | It gives you the tools, the agent loop, and the context handling of Claude Code, in Python and TypeScript Source 2সোর্স 2 |
| Claude API tool use | Build your own loop | Your code runs a client tool and returns a tool_result Source 4সোর্স 4 |
| Playwright MCP | Browser tools for an agent | Add it with claude mcp add playwright npx @playwright/mcp@latest Source 7সোর্স 7 |
সহজ English
- Claude Code: an agent in your terminal, IDE, or CI. It works in three phases: gather context, take action, verify results Source 1সোর্স 1.
- Claude Agent SDK: the Claude Code loop as a library. It gives you the tools, the loop, and the context handling of Claude Code. It works in Python and TypeScript Source 2সোর্স 2.
- Claude API tool use: build your own loop. Your code runs a client tool and returns a
tool_resultSource 4সোর্স 4. - Playwright MCP: browser tools for an agent. Add it with
claude mcp add playwright npx @playwright/mcp@latestSource 7সোর্স 7.
বাংলা ব্যাখ্যা
- Claude Code: আপনার টার্মিনাল, IDE বা CI-তে চলা একটা এজেন্ট। এটা তিন ধাপে কাজ করে: gather context, take action, verify results Source 1সোর্স 1।
- Claude Agent SDK: Claude Code-এর লুপ, একটা লাইব্রেরি হিসেবে। এটা আপনাকে Claude Code-এর টুল, agent loop আর context handling দেয়। এটা Python আর TypeScript-এ চলে Source 2সোর্স 2।
- Claude API tool use: নিজের লুপ নিজে বানান। আপনার কোড একটা client tool চালায় এবং একটা
tool_resultফেরত দেয় Source 4সোর্স 4। - Playwright MCP: এজেন্টের জন্য ব্রাউজার টুল।
claude mcp add playwright npx @playwright/mcp@latestদিয়ে যোগ করুন Source 7সোর্স 7।
Common mistakes
- No stop rule. With no limits, the loop runs until the agent finishes, and an open-ended prompt can run long Source 3সোর্স 3. Fix: give a clear goal, and set
max_turnsor a budget in scripts. - "Done" with no proof. An agent stops when the work looks done Source 9সোর্স 9. Fix: ask for the command it ran and its output Source 9সোর্স 9.
- Too much permission. The
bypassPermissionsmode is only for isolated environments Source 3সোর্স 3. Fix: allow only the tools and commands that the task needs, for exampleBash(npm *)Source 3সোর্স 3. - Trusting outside content. A server that fetches outside content can bring a prompt injection risk Source 8সোর্স 8. Fix: connect only servers that you trust, and point the agent at test data.
- Side effects you cannot undo. Claude Code checkpoints undo file edits only. Changes to databases, APIs, and deployments cannot be rolled back that way Source 1সোর্স 1. Fix: run agents against a test environment.
সহজ English
- No stop rule. With no limits, the loop runs until the agent finishes. An open-ended prompt can run for a long time Source 3সোর্স 3. Fix: give a clear goal. In scripts, set
max_turnsor a budget. - "Done" with no proof. An agent stops when the work looks done Source 9সোর্স 9. Fix: ask for the command it ran and its output Source 9সোর্স 9.
- Too much permission. The
bypassPermissionsmode is only for isolated environments Source 3সোর্স 3. Fix: allow only the tools and commands that the task needs, for exampleBash(npm *)Source 3সোর্স 3. - Trusting outside content. A server that fetches outside content can bring a prompt injection risk Source 8সোর্স 8. Fix: connect only servers that you trust. Point the agent at test data.
- Side effects you cannot undo. Claude Code checkpoints undo file edits only. They cannot undo changes to databases, APIs, or deployments Source 1সোর্স 1. Fix: run agents against a test environment.
বাংলা ব্যাখ্যা
- থামার কোনো নিয়ম নেই। কোনো সীমা না থাকলে এজেন্ট কাজ শেষ না করা পর্যন্ত লুপ চলে। খোলা-মাথার (open-ended) প্রম্পট অনেকক্ষণ চলতে পারে Source 3সোর্স 3। সমাধান: পরিষ্কার লক্ষ্য দিন। স্ক্রিপ্টে
max_turnsবা একটা বাজেট সেট করুন। - প্রমাণ ছাড়া "Done"। কাজ শেষ মনে হলেই এজেন্ট থামে Source 9সোর্স 9। সমাধান: সে কোন কমান্ড চালিয়েছে আর তার আউটপুট কী, তা চেয়ে নিন Source 9সোর্স 9।
- বেশি অনুমতি।
bypassPermissionsমোড শুধু আলাদা করা (isolated) এনভায়রনমেন্টের জন্য Source 3সোর্স 3। সমাধান: কাজে যে টুল আর কমান্ড লাগে শুধু সেগুলোর অনুমতি দিন, যেমনBash(npm *)Source 3সোর্স 3। - বাইরের কনটেন্টে বিশ্বাস। যে সার্ভার বাইরের কনটেন্ট আনে, সে prompt injection-এর ঝুঁকি আনতে পারে Source 8সোর্স 8। সমাধান: শুধু বিশ্বস্ত সার্ভার যুক্ত করুন। এজেন্টকে টেস্ট ডেটায় কাজ করান।
- যে ক্ষতি ফেরানো যায় না। Claude Code-এর checkpoint শুধু ফাইল এডিট ফেরাতে পারে। ডেটাবেস, API বা deployment-এর পরিবর্তন সে ফেরাতে পারে না Source 1সোর্স 1। সমাধান: এজেন্টকে টেস্ট এনভায়রনমেন্টে চালান।
How to start
- Open Claude Code in a test project in Plan mode. In this mode it explores and proposes a plan, and it does not edit your source files Source 1সোর্স 1. Ask it to explain how the tests are organized.
- Give one small task with a check: "run the login tests, fix the first failure, and show me the test output".
- Allow the safe commands that you run often, such as
npm test, in.claude/settings.jsonSource 1সোর্স 1. See Settings. - Add Playwright MCP and ask the agent to walk through one flow on a staging site.
- When a task repeats, move it to a headless run in CI with a turn limit.
সহজ English
- Open Claude Code in a test project in Plan mode. In this mode, it explores and proposes a plan. It does not edit your source files Source 1সোর্স 1. Ask it to explain how the tests are organized.
- Give one small task with a check: "run the login tests, fix the first failure, and show me the test output".
- Allow the safe commands that you run often, such as
npm test, in.claude/settings.jsonSource 1সোর্স 1. - Add Playwright MCP. Ask the agent to walk through one flow on a staging site.
- When a task repeats, move it to a headless run in CI with a turn limit.
বাংলা ব্যাখ্যা
- একটা টেস্ট প্রজেক্টে Claude Code Plan মোডে খুলুন। এই মোডে সে ঘুরে দেখে আর একটা প্ল্যান দেয়, আপনার সোর্স ফাইল এডিট করে না Source 1সোর্স 1। টেস্টগুলো কীভাবে সাজানো, তা ব্যাখ্যা করতে বলুন।
- একটা চেকসহ একটা ছোট কাজ দিন: "run the login tests, fix the first failure, and show me the test output"।
- যে নিরাপদ কমান্ডগুলো আপনি প্রায়ই চালান, যেমন
npm test, সেগুলো.claude/settings.json-এ allow করুন Source 1সোর্স 1। - Playwright MCP যোগ করুন। এজেন্টকে একটা staging সাইটে একটা flow পার হতে বলুন।
- কোনো কাজ বারবার হলে সেটাকে turn limit সহ CI-তে headless রানে নিয়ে যান।
Key words
| Word | Meaning |
|---|---|
| Agent | A program that plans its own steps and calls tools to finish a task Source 2সোর্স 2 |
| Agentic loop | Gather context, take action, verify results, and repeat Source 1সোর্স 1 |
| Turn | One cycle of tool calls and tool results inside the loop Source 3সোর্স 3 |
| Tool use | The model asks for a tool call, and an application or Anthropic runs it Source 4সোর্স 4 |
| Subagent | A helper agent with its own context window, prompt, and tools Source 6সোর্স 6 |
| Prompt injection | An attack that puts harmful text into content to take over the AI's instructions Source 10সোর্স 10 |