Try Bifrost Enterprise free for 14 days.
Request access
[ AI Agent ]

What is an AI agent?

Quick answer

An AI agent is a system in which a large language model (LLM) decides what happens next. It chooses an action, has a tool carry it out, observes the result, and repeats until the task is done, with no developer writing the sequence of steps in advance.

Updated 2026-09-07

An AI agent is a system where a language model decides what happens next. It receives a goal, chooses an action, has a tool carry it out, observes the result, and repeats. No developer writes the sequence of steps in advance; the model chooses each one at runtime.

"Software programs that can interact with their environment, receive information, and undertake self-directed actions in service of a larger, externally-specified goal."

Source: NIST AI 100-2e2025, glossary definition of "agent"

This property, dynamic control flow, separates an agent from other LLM applications. A pipeline that always searches, then summarizes, then answers is a program with a model inside it, however sophisticated its prompts are.

The two have different operational profiles. A fixed pipeline has bounded cost, predictable latency, and testable behavior. An agent has none of those by default, and getting them back is most of the engineering work.

Agents vs. workflows

Anthropic's Building Effective Agents draws the line clearly: workflows orchestrate models and tools through predefined code paths, while agents let models dynamically direct their own processes and tool usage.

WorkflowAgent
Control flowWritten by the developerChosen by the model at runtime
Step countKnown before executionUnknown, bounded only by a cap
Cost per requestPredictableVariable, since step count varies
Failure modeA step errorsThe loop wanders, repeats, or stops early
TestingDeterministic given fixed inputsRequires repeated sampling
Right forWell-defined tasks with stable structureOpen-ended tasks where the path cannot be enumerated

Start with the simplest thing that works, which is also Anthropic's recommendation. If a task described as "agentic" is really a workflow with a routing step, building it as a workflow makes it cheaper, faster, and easier to debug. Reach for a true agent when valid paths are too numerous to enumerate, such as debugging an unfamiliar codebase or researching an open question.

The agent loop

Whatever the framework, an agent reduces to the same cycle.

Diagram
[ RENDERING DIAGRAM ]

The model never executes anything itself. It returns a structured call that your application runs, or that the provider runs for server-side tools (Anthropic tool use docs), the mechanism described in function calling. Each turn's input contains all previous conversation history (Anthropic context window docs), so every iteration resends the growing history and cumulative input tokens grow faster than the step count. The dotted line is required. Without a hard stop, a confused agent loops until it exhausts its context window or your budget.

Agent architecture

An agent has four components. Most of the engineering goes into memory and orchestration.

  • Model: the decision maker, which sets the ceiling on everything else. In a loop, one plausible wrong action does not stay contained, because every later step reasons over its output.
  • Tools: the action space. What an agent can do is exactly the set of tools it holds.
  • Memory: what the agent knows now versus what it knew before.
  • Orchestration: the loop, plus the caps, retries, and termination conditions that bound it.

Agent tools

Tool definitions deserve as much care as the prompt. For its SWE-bench agent, Anthropic reports that it spent more time optimizing its tools than the overall prompt.

Keep the tool set small. Anthropic's docs note that Claude's ability to pick the right tool degrades once you exceed 30 to 50 available tools, and descriptions begin to overlap. If two tools need a paragraph to distinguish, the model will confuse them too.

Scope permissions per tool, not per agent. A read-only lookup tool should hold read-only credentials, in line with OWASP's advice to limit extension permissions to the minimum necessary. When an injected instruction reaches the model through a retrieved document, the credential attached to the tool is the control that still holds. Guardrails can block the injection; they do not replace scoped credentials.

The Model Context Protocol is an open standard for connecting AI applications to external systems, so a capability built once as an MCP server works with any MCP-capable agent. It also widens the action space quickly, which is why per-key control over which MCP tools are exposed matters past a handful of servers. The MCP gateway is where that filtering, approval, and audit trail live in practice.

Agent memory

Agent memory is a retrieval problem. Beyond what it learned in training, everything the model knows about the task must be in the context window for that step, so memory splits into two layers:

Working memoryPersistent memory
Where it livesThe context windowVector store, database, or files
LifetimeOne requestAcross sessions
CapacityUp to 1M tokens on some models (Anthropic); recall degrades as token count growsEffectively unbounded
CostBilled on every stepStorage plus one retrieval per step
Failure modeTruncation, or degraded attention over long contextRetrieving the wrong thing, or nothing

Persistent memory is useful only when something selects the right fragments and injects them into working memory, which is retrieval-augmented generation applied to the agent's own history. One failure to design against is retrieving a stale fact that has since been superseded, then acting on it confidently.

Appending every tool result to history is why long runs get slow and expensive. On long runs, compaction and tool result clearing, which summarize older turns or drop raw tool output the agent no longer needs, keep cost and attention in check.

Planning patterns

  • ReAct interleaves reasoning traces with actions, so the model states its rationale before each tool call. Yao et al., who introduced it, report better task performance and improved human interpretability over methods without the reasoning or acting components.
  • Reflection adds self-critique after failure. Reflexion has the agent reflect verbally on task feedback, keep that reflective text in an episodic memory buffer, and retry, so it depends on the feedback signal being reliable.
  • Plan-and-execute generates a plan up front, then executes against it. ReWOO (Xu et al., 2023) detaches the reasoning process from tool observations to cut token use. The trade-off is that a fixed plan cannot react to a surprising tool result unless something triggers replanning.

Reasoning models blur these patterns. OpenAI's reasoning best practices say that prompting them to "think step by step" is unnecessary and can sometimes hinder performance, so an explicit ReAct scaffold on top may duplicate work. Test rather than assume.

Multi-agent systems

A multi-agent system splits work across specialized agents, usually an orchestrator delegating to subagents.

Diagram
[ RENDERING DIAGRAM ]

Multi-agent setups help only under specific conditions.

Multi-agent helps whenMulti-agent hurts when
Subtasks are genuinely parallel and independentSteps are sequential and each depends on the last
Each subagent needs a different, large tool setOne agent could hold all the tools without confusion
Subtasks need isolated context to avoid interferenceHandoffs lose context that the next agent needs
Task value justifies the token costCost or latency is a binding constraint

Anthropic reported that in its multi-agent research system, multi-agent systems used about 15 times the tokens of a chat interaction, against about 4 times for a single agent, and that they need tasks valuable enough to pay for the increased performance. Coordination adds its own failure class: the same post describes subagents duplicating work and leaving gaps without detailed task descriptions. Frameworks such as Microsoft Agent Framework, the successor to AutoGen, make these topologies easy to build, so check the conditions above before reaching for one.

Why agents fail in production

Agent reliability degrades multiplicatively. If each step succeeds independently with probability p, an n-step task succeeds with probability p^n.

Per-step success rate5 steps10 steps20 steps
90%59%35%12%
95%77%60%36%
99%95%90%82%

A 95 percent per-step success rate, excellent in isolation, produces roughly a 60 percent task success rate over ten steps. That compounding argues for shorter loops, verification steps that catch errors before they propagate, and checkpoints an agent can resume from.

Latency accumulates, since ten sequential model calls are ten round trips. Cost is unbounded by default, because nothing in the loop tracks what it has already spent. Non-determinism breaks conventional testing, since the same input can yield different action sequences, so one passing run proves nothing.

Agent observability

Request-level logging isn't enough for agents. Traces must be step-level, with a span per model call and per tool execution, linked under one trace ID for the run. OpenTelemetry's GenAI agent span conventions define invoke_agent and execute_tool operations for this.

Metrics that diagnose problems:

  • Steps per task, as a distribution rather than a mean. A long tail means the agent is getting stuck.
  • Tool selection accuracy and argument validity rate, which depend on tool definitions you control.
  • Cost and tokens per completed task, not per request.
  • Termination reason: completed, iteration cap, budget cap, or error. A rising share of cap-triggered stops is an early warning.

See LLM observability for instrumentation patterns.

Operational controls

A single user action can produce bursty, multi-step, multi-tool traffic, a pattern that quotas sized for chat do not anticipate. The controls that bound an agent belong at the boundary, not in application code where every team reimplements them differently.

py

Bifrost sits at this boundary. A virtual key gives each agent its own credential. Budgets and rate limits stop a runaway loop once its allowance is used up. Per-key MCP tool filtering is deny-by-default, so an agent sees only the tools its key allows. Tool calls don't run until your app executes them, unless you turn on agent mode. Agent mode auto-runs only allowlisted tools (none by default) and caps the loop with max_agent_depth (default 10). CLI agents such as Claude Code route through the same keys and controls. The broader policy layer is covered under AI governance.

Key takeaways

  • Reliability compounds multiplicatively. 95 percent per step is about 60 percent over ten steps, which is the argument for short loops and verification.
  • Anthropic measured multi-agent systems at about 15 times the tokens of a chat interaction, so they need parallel, high-value subtasks to justify the cost.
  • Scope credentials per tool. Tool permissions are the control that still holds when a prompt injection reaches the model.
  • Bound every agent with an iteration cap, a spend cap, and step-level tracing before it reaches production.

Sources and further reading