Prompt.Lab

AI agents / Practical guide

AI agents are more than chatbots. Here’s what they actually do.

Codex, Claude Code, subagents, agent teams, tools, permissions, and verification—explained as one understandable system, with prompts you can use on real work.

Prompt.Lab Editorial15 min readOfficial sources reviewed

A chatbot waits for a message and writes a response. An AI agent can receive a goal, inspect the environment, use tools, take a sequence of actions, check the result, and continue until it reaches a stopping point. That difference is why agents can work on a repository, research a question, diagnose a failure, or coordinate other specialist agents.

“Agent” is not a magic label for a smarter model. It describes a working system around the model: instructions, context, tools, permissions, memory, feedback, and a definition of done. Remove those pieces and even a powerful agent becomes a chatbot making confident guesses.

The shortest useful definition

An AI agent is a model operating inside a loop, with tools and boundaries.

Its advantage is not that it always knows the answer. It can gather new evidence, act on that evidence, and test whether the action worked.

Chatbot, agent, coding agent, or subagent?

TermWhat it doesBest mental model
ChatbotResponds to the current conversation.A knowledgeable adviser.
AI agentPursues a goal through multiple tool-assisted steps.An operator with a checklist.
Coding agentWorks inside a software environment: files, commands, tests, and version control.A developer working in your repository.
SubagentHandles one delegated specialty in a separate context and reports back.A focused team member.
Agent teamLets several independent agents work in parallel and coordinate results.A small project team.

These categories overlap. A coding agent may delegate a security review to a subagent. A main agent may ask two researchers to inspect different sources, then synthesize their findings. The names matter less than the boundaries: who owns the goal, which tools can be used, and who verifies the final result.

The six-part agent loop

01

Goal

A concrete outcome defines where the agent should finish.

02

Plan

The agent breaks the outcome into smaller, ordered decisions.

03

Tools

It reads files, searches sources, runs commands, or calls approved services.

04

Action

It changes something: code, a document, a test, or a workflow state.

05

Evidence

A build, test, diff, citation, or observable result shows what happened.

06

Correction

If the evidence disagrees with the goal, the agent revises the plan and tries again.

A useful agent does not merely generate a plan and declare success. It connects the plan to observable evidence. If the website build fails, the task is not complete. If a research claim has no source, it remains unverified. If the requested button exists but cannot be used with a keyboard, the acceptance criteria were incomplete.

What Codex can actually do

Codex is OpenAI's coding agent environment. Depending on how it is configured, it can inspect a repository, edit files, run development commands, review diffs, work with connected tools, and continue through a multi-step software task. The useful part is the complete workflow around the code—not just producing a snippet in chat.

Map an unfamiliar codebase before changing it.

Diagnose a bug from logs, code paths, tests, and reproduction steps.

Build a focused feature and run the project’s real verification commands.

Review a diff for regressions, missing tests, security risks, or scope creep.

Research official documentation and translate it into an implementation.

Delegate independent investigations to subagents and synthesize their findings.

Codex still needs authority boundaries. A task should make clear whether it may only inspect, may edit local files, may install dependencies, or may publish changes. More autonomy without a clear definition of done creates more ways to finish the wrong job.

What Claude Code can actually do

Claude Code is Anthropic's agentic coding tool. Its official documentation describes workflows for reading and editing code, running commands and tests, working with Git, connecting development tools, and creating specialized subagents. Like Codex, it is most effective when it can inspect the real project and verify the result inside the real environment.

The practical differences between coding agents change as products evolve. Do not choose from a screenshot or a single benchmark. Test the same representative task in your repository: exploration quality, edit accuracy, command safety, verification, context handling, and the clarity of the final handoff.

Evaluate this repository task before making changes.

Goal: [OBSERVABLE OUTCOME]
Allowed scope: [FILES, FOLDERS, OR SERVICES]
Do not change: [PROTECTED BEHAVIOR]

First inspect the relevant code and report:
- the current data flow;
- the likely change surface;
- risks and unknowns;
- a verification plan.

Wait for approval before implementation.

What subagents are—and why one agent creates them

A subagent is a delegated worker with a focused role and its own context. Instead of making the main agent carry every file, source, and instruction at once, the main agent can assign bounded investigations and receive compact reports.

LEAD

Coordinator

Owns the user's goal, divides the work, resolves conflicts, and produces the final answer.

01

Research worker

Checks official sources and returns supported facts, dates, and unresolved questions.

02

Developer worker

Inspects one component or implements a bounded change with focused verification.

03

Reviewer worker

Challenges assumptions, reviews the diff, and looks for omissions or regressions.

Anthropic distinguishes subagents from agent teams: subagents usually report back to a main agent, while a team can contain more independent sessions that communicate and coordinate. OpenAI also documents multi-agent workflows in which one agent coordinates parallel specialists and synthesizes their results.

Important trade-off

Parallel agents can reduce elapsed time while increasing total work.

Each agent consumes context and compute. Delegating a tiny linear task to four workers may cost more, add conflicting conclusions, and take longer to review than doing it once.

When subagents help—and when they do not

Use subagents when…Use one agent when…
Investigations are independent and can run in parallel.Every step depends on the result of the previous step.
Specialists need different tools, instructions, or files.The task is small enough to hold in one clear context.
You want an independent review of important work.Coordination would cost more than the work itself.
The main context is becoming crowded with detail.Several workers would edit the same area and collide.

Eight jobs agents can perform surprisingly well

  1. Repository archaeology: trace a feature across routes, services, database calls, tests, and UI states.
  2. Failure diagnosis: reproduce a bug, compare expected and actual behavior, then test the smallest plausible fix.
  3. Migration planning: identify affected APIs, compatibility risks, rollout steps, and rollback conditions.
  4. Documentation research: compare primary sources and attach each recommendation to evidence.
  5. Security review: examine authorized code and configuration defensively, without inventing exploit claims.
  6. Quality control: run tests, build the project, inspect the diff, and report exactly what remains unverified.
  7. Structured production: turn a brief into code, content, tests, metadata, and a reviewed handoff.
  8. Longer goal pursuit: keep moving through a bounded plan instead of stopping after one response.

Three prompts that reveal the difference

1. Give one coding agent a complete feature task

Act as the primary coding agent for this repository.

Objective: [FEATURE WITH OBSERVABLE USER OUTCOME]
Constraints: [SCOPE, COMPATIBILITY, SECURITY, DEPENDENCIES]
Acceptance criteria:
- [CRITERION 1]
- [CRITERION 2]

Workflow:
1. inspect the repository and preserve unrelated changes;
2. explain the current behavior and propose a minimal plan;
3. implement only the approved scope;
4. run the relevant tests, lint, build, and focused manual checks;
5. review the final diff;
6. report evidence, remaining uncertainty, and any decision I still own.

Ask before any destructive, external, or irreversible action.

2. Split an investigation among subagents

Coordinate this project using subagents only where work is independent.

Goal: [PROJECT OUTCOME]

Delegate:
- Research: verify the official API and security requirements.
- Architecture: map the existing data flow and likely change surface.
- Verification: define tests and failure cases before implementation.

Give every worker a bounded question and request evidence, not general advice.
Do not let workers edit overlapping files.
Synthesize the reports into one plan, show disagreements, and wait for approval.

3. Ask for an independent review

Review this completed change as an independent senior maintainer.

Use the original goal, acceptance criteria, repository conventions, and full diff.
Check for:
- incorrect behavior or unhandled states;
- security, privacy, accessibility, and performance risks;
- accidental scope expansion;
- missing or weak verification;
- claims that are not supported by evidence.

Do not edit. Rank findings by impact, cite exact files, and say when no issue is found.

The five boundaries every agent task needs

Authority: what the agent may inspect, edit, install, publish, or call.

Scope: which files, services, people, and data are inside the task.

Secrets: credentials and personal data stay in protected systems, not prompts or commits.

Verification: the real commands or observations that prove the outcome.

Escalation: which decisions or risky actions must return to a human.

Agents can hallucinate, misunderstand a repository, overfit to a test, or carry out a precisely stated bad plan. Tool access magnifies both usefulness and mistakes. Use least-privilege permissions, review consequential changes, protect credentials, and keep a recoverable path for anything important.

The agent lesson

Your AI agent is only as effective as the goal, boundaries, evidence, and definition of done you give it.

Ready to delegate?

Structure your next agent task with Prompt.Lab.

Describe the outcome in plain language. Prompt.Lab will turn it into a clearer role, objective, constraints, and required output for the AI you choose.

Turn theory into a better result

Your idea is good.
Give it better instructions.

Paste a rough request into Prompt.Lab and get a structured prompt for ChatGPT, Claude, or Gemini.

Try Prompt.Lab free →

Continue exploring

View all →