Architecture
The agent engineering glossary
Building an AI agent that works in a notebook takes an afternoon. Running one in production across real business systems requires a shared vocabulary drawn from language models, distributed systems, and security engineering.
This glossary defines 56 terms engineers use day to day when designing, evaluating, and operating AI agents. Each entry explains the concept in plain language without tying it to one vendor, explains why it matters in production, and notes how Bruce approaches it (or where Bruce deliberately does not) whenever that reflects our live architecture.
How the nine areas fit inside a production agent
Select any area to jump directly to its termsThe agent loop and planning
6 termsAn agent is a software system in which a language model dynamically chooses its own sequence of steps and tool calls to complete a goal, rather than following a fixed, hard-coded script. On each turn of the loop, the model inspects the current state, decides whether to call a tool or ask for input, reads the result, and repeats until the task is finished or blocked. Unlike a single-turn chat completion, an agent acts on external state and adapts when an intermediate step fails or returns unexpected data.
- Why it matters
- Treating an agent as a closed-loop system rather than a smarter autocomplete changes every engineering decision around it, from retry semantics and permissions to evaluation and cost control.
An agent harness is the deterministic software runtime that wraps a language model and turns raw model completions into reliable work. It manages the execution loop, prompt assembly, tool execution, state persistence, permissions, error handling, and logging. Models change every few months; the harness carries the operating contract that stays stable across those upgrades.
- Why it matters
- Two teams running the exact same foundation model get dramatically different reliability depending on their harness. Most production failures in agents come from harness gaps rather than model intelligence.
- In Bruce
- Bruce separates swappable model presets, a central tool registry, a scoped memory store, and runtime permission and write-recording layers so the underlying model can be upgraded without rewriting the surrounding execution harness. See How we arrived at a seven-plane harness for enterprise.
Chain of thought is the practice of having a language model generate intermediate reasoning steps before producing a final answer or action. Early implementations elicited these steps through few-shot prompting, while modern reasoning models are trained to produce internal reasoning tokens natively before responding. Breaking a multi-step problem into intermediate steps improves accuracy on math, code, and multi-constraint logic.
- Why it matters
- Reasoning steps improve decision quality on complex tasks, but they add latency and output token cost. Engineers balance reasoning depth against speed depending on whether a step is a simple routing check or a multi-system investigation.
A planner is the component or phase of an agent that decomposes a broad objective into an ordered list of subgoals or steps before or during execution. Some planners generate a complete plan up front and hand steps to workers; others maintain a live checklist and revise it as tool results arrive. Good planning keeps an agent from wandering into dead ends or forgetting an earlier requirement halfway through a long task.
- Why it matters
- Without explicit task decomposition, long multi-step jobs drift, repeat work, or stop prematurely before every part of the request is finished.
- In Bruce
- During interactive chat turns, Bruce writes and works through a structured step checklist (
write_todos) so it finishes multi-step requests in one run rather than stopping after the first step. Specialized outreach flows use a dedicated state-graph planner to sequence multi-step actions.
ReAct (Reason and Act) is an agent execution pattern that interleaves short reasoning traces with concrete tool actions and their returned observations. Instead of reasoning purely in its head or firing tools blindly, the model states what it needs to check, invokes a tool, reads the observation from the environment, and updates its next step based on real data. Most modern tool-using agents implement some variation of this observe-think-act cycle.
- Why it matters
- Interleaving reasoning with live observations grounds the agent in current system state and lets it recover from missing fields, empty search results, or API errors mid-run. See ReAct: Running the Full GTM Cycle as a Closed-Loop Execution System.
A workflow executes a predefined code path where developers decide the sequence of model calls, branches, and tool invocations in advance. An agent lets the language model decide which tools to call and how many steps to take at runtime based on intermediate observations. Workflows trade flexibility for predictability, lower latency, and simpler testing, while agents handle open-ended requests whose path cannot be known ahead of time.
- Why it matters
- Using a free-form agent where a deterministic workflow suffices adds unnecessary latency, token spend, and failure modes. Mature systems combine fixed workflows for repeatable processes with agent loops for ambiguous work.
- In Bruce
- Bruce uses both patterns. Open-ended chat runs inside an agent loop, while repeatable processes like inbound quote handling run as a fixed four-step workflow and recurring operational work runs through scheduled routines.
Tools and protocols
6 termsA2A is an open communication protocol, now hosted by the Linux Foundation, that lets independent AI agents discover each other's capabilities and exchange tasks across organizational or vendor boundaries. Each agent publishes an Agent Card describing what it can do, and callers send structured task requests and receive streamed status updates or artifacts over standard HTTP and JSON-RPC. Where MCP connects an agent to tools and data, A2A is designed to connect one opaque agent to another.
- Why it matters
- As organizations deploy specialized agents from different vendors, a standard agent-to-agent contract avoids brittle one-off webhooks and lets systems delegate work without exposing internal prompts or tools.
- In Bruce
- Bruce does not currently expose or consume the A2A protocol. Multi-step delegation inside Bruce happens through its own internal sub-agents and scheduled routines.
Code execution gives an agent the ability to write and run short programs (typically Python or shell scripts) inside an isolated runtime to query APIs, transform data, run calculations, or assemble files. Instead of shipping hundreds of narrow single-purpose tools for every possible filter or aggregation, the model composes code directly against a library or SDK and inspects only the concise output. This keeps large raw payloads out of the model's context window.
- Why it matters
- Language models are notoriously unreliable at arithmetic and large table joins in plain text, whereas generated code computes exact results over thousands of rows in milliseconds.
- In Bruce
- Rather than mirroring a company's ERP or CRM into a separate warehouse, Bruce writes task-specific Python and runs it against live connected systems inside an isolated Docker sandbox, returning exact results to the conversation.
Function calling is the model capability and API interface that allows a language model to emit a structured invocation of a developer-defined function instead of plain prose. The application supplies function names, descriptions, and parameter schemas in the request; when the model decides a function is needed, it returns a structured JSON payload of arguments for the host application to execute. The model never executes the function itself.
- Why it matters
- Function calling is the bridge between text generation and real software. Reliable argument formatting is what lets an agent safely interact with databases, calendars, and external APIs.
Model Context Protocol (MCP) is an open specification that standardizes how AI applications connect to external tools, data sources, and prompt templates. An MCP server exposes a uniform list of tools and resources, and any MCP-compatible client or agent host can discover and invoke them without custom glue code per integration. Engineers often compare MCP to a universal plug standard for connecting models to external software.
- Why it matters
- Without a shared protocol, every agent platform has to build and maintain bespoke adapters for every tool vendor. MCP lets teams wire new internal or third-party systems into an agent with one consistent interface.
- In Bruce
- Bruce supports both built-in and customer-configured remote MCP servers at the organization or individual user level, loading their tools into the active agent session alongside native integrations.
A tool call is a single runtime invocation in which an agent asks its host harness to execute a specific external capability (such as searching records, reading a file, or creating an invoice) with a set of structured arguments. The harness validates the call, runs the underlying code or API request, and appends the returned result back into the conversation as a tool output message. One user request commonly triggers anywhere from one to dozens of sequential or parallel tool calls.
- Why it matters
- Every tool call is a trust boundary, a latency step, and a potential side effect. Designing clean, composable tool calls with clear error messages directly determines whether an agent recovers gracefully or loops on failures.
- In Bruce
- Bruce maintains a central registry of 87 custom tools that each organization can turn on or off, combined with dynamically loaded MCP tools. Having a tool available in a session does not grant blanket write authority: governed write paths (such as CRM, ERP, accounting, and outbound email) pass through runtime permission gates, though lightweight workspace mutations like Gmail read-state updates do not carry a permission gate.
A tool schema is the machine-readable contract (almost always JSON Schema) sent to a language model to describe a tool's name, purpose, parameter names, types, enums, and required fields. Because the model relies on this schema and its field descriptions to decide when and how to call the tool, unclear names or overlapping parameters cause immediate tool-selection errors. Tool schemas also consume context tokens on every turn.
- Why it matters
- Writing a good tool schema is closer to API design than prompt writing. Tight schemas with unambiguous descriptions, sensible defaults, and strict types eliminate whole classes of malformed calls before execution begins.
Memory and context
7 termsCompaction is the process of condensing earlier turns and bulky tool outputs in a long-running agent conversation into a shorter summary so the session can continue without exhausting the context window. Good compaction preserves active goals, verified facts, open decisions, and file or record identifiers while discarding verbose intermediate logs. It can run automatically at a token threshold or be triggered between phases of a job.
- Why it matters
- Without compaction, long agent sessions either crash at the context limit or degrade in quality as old tool dumps crowd out the current task. Poor compaction, however, silently drops constraints the user gave ten turns ago.
- In Bruce
- Bruce compacts long chat histories through a summarization middleware wrapper that caches converted tool schemas per turn, avoiding the latency cost of re-serializing every bound tool schema on every model hop just to count tokens.
Context engineering is the discipline of deciding exactly what information enters a language model's context window at each step of an agent run. It encompasses system instructions, tool schemas, retrieved records, standing rules, conversation history, and formatted tool outputs, treated as a finite attention budget rather than an unlimited dumping ground. While prompt engineering focuses on wording a single instruction, context engineering manages the entire evolving state of a multi-turn run.
- Why it matters
- Frontier models fail more often from missing, contradictory, or noisy context than from weak wording. Engineering what to include, when to fetch it, and what to leave out is the highest-leverage work in agent reliability.
Context rot is the empirically observed drop in a language model's recall, instruction following, and reasoning accuracy as total input length grows, even well below the model's advertised maximum context window. Empirical evaluations show that performance degrades as prompts fill with long histories, verbose tool outputs, and topically similar distractors. More tokens do not equal better understanding.
- Why it matters
- Teams that dump entire databases, email threads, or raw API responses into a giant window watch accuracy fall and costs climb at the same time. Keeping context lean and relevant beats relying on a larger window. See Why Long Context Is Hard for Agents.
A context window is the maximum number of tokens a language model can process in a single request, covering the system prompt, tool schemas, conversation history, tool outputs, and generated response. Anything outside that window is invisible to the model unless the harness retrieves and re-injects it. Modern frontier models advertise windows from hundreds of thousands to a million tokens, though effective accuracy often peaks well before the hard ceiling.
- Why it matters
- The context window is the agent's working memory, not its database. Treating it as permanent storage drives up latency and cost per task while inviting context rot.
In agent systems, short-term memory refers to the active working state held inside the current context window (recent messages, intermediate tool outputs, and the active plan). Long-term memory refers to information persisted outside the model across sessions, such as user preferences, company rules, learned lessons, or past summaries, which the harness retrieves when relevant. Separating the two lets an agent stay fast on the current turn while carrying institutional knowledge over weeks and months.
- Why it matters
- An agent without long-term memory forces users to repeat rules every session; an agent with poorly scoped or uncurated long-term memory leaks private context across users or applies stale rules to new tasks.
- In Bruce
- Bruce stores long-term memory as individual records across four scopes (
org,user,tool, andagent) with an event history, archiving changed or forgotten items instead of deleting them. Each turn recalls standing rules plus up to five hybrid keyword-and-vector matches (capped at 900 characters each) appended to the user message so the system prompt stays stable; chats summarize into lessons after 20 quiet minutes. Bruce does not currently run automated staleness scoring or per-role ACLs on individual organization facts. See Building memory an agent can trust.
Prompt caching is a model-serving optimization that reuses the computed attention state (KV cache) for an unchanged prefix of a prompt across repeated API calls within a time-to-live window. Because an agent loop sends the same system prompt, tool definitions, and earlier conversation turns over and over, caching that stable prefix dramatically cuts both input token cost and time to first token. Putting volatile values like timestamps or dynamically recalled notes at the very top of the system prompt breaks the cache prefix.
- Why it matters
- In a 15-step agent run, the majority of input tokens are re-reads of earlier turns. Designing prompts with a stable prefix and verified cache hits routinely cuts agent loop spend and latency substantially.
- In Bruce
- For Bedrock-hosted Claude models, Bruce injects
cache_controlwith a five-minute TTL at generation time inside a custom chat wrapper so downstream tool-binding calls cannot silently drop cache points, while OpenAI models cache stable prefixes implicitly. Recalled memory rides on the user message rather than mutating the system prompt so the cached prefix stays intact.
Retrieval-augmented generation (RAG) is a technique that searches an external knowledge source (using vector embeddings, keyword search, or both) for passages relevant to a query and injects them into the model's prompt before generation. Rather than relying solely on knowledge frozen into model weights during training, the model answers using fresh, inspectable documents retrieved at runtime. In agent systems, RAG is often one tool among many rather than the entire pipeline.
- Why it matters
- RAG reduces fabrication on private or fast-changing documentation without fine-tuning, but chunking mistakes, stale indexes, and missing structured joins make pure RAG brittle for operational data that lives in live transactional systems. See RAG vs Neuro-Symbolic Execution.
Orchestration and execution graphs
6 termsA checkpoint is a persisted snapshot of an agent's execution state (messages, active variables, pending tool calls, and current graph node) saved at discrete step boundaries. With checkpoints stored in durable storage such as a database, a run can pause for human approval, survive a dropped client connection, or resume from a known step without repeating earlier work. Checkpoints also enable time-travel debugging by replaying from the exact state before a failure.
- Why it matters
- Real enterprise work rarely finishes in a single uninterrupted HTTP request. Checkpoints separate the lifetime of a job from the lifetime of a browser tab or worker process.
- In Bruce
- Chat graph state is stored in PostgreSQL via
AsyncPostgresSaver, and each session is serialized under a 60-second Redis turn lock so pending approvals outlive closed tabs and requests. An in-flight streaming turn on the inline chat path does not yet survive an API server restart; durability currently guarantees staged approvals rather than mid-stream process failover.
Durable execution is an execution model in which long-running workflows survive process crashes, network partitions, worker restarts, and hours-long waits without losing progress or duplicating completed side effects. The runtime persists execution history or checkpoints and replays or resumes unfinished work automatically when a worker recovers. It brings the reliability properties of distributed workflow engines to multi-step agent jobs.
- Why it matters
- An agent waiting overnight for a manager's approval or polling a slow third-party system will inevitably cross deploys and transient outages. Without durable execution, every restart leaves half-finished business operations behind.
- In Bruce
- Scheduled routines persist run state in database records and rely on background recovery sweeps to catch stalled runs, while chat approvals persist in PostgreSQL checkpoints. Bruce does not implement cross-system sagas or automatic rollback compensation when a write succeeds in one external system and fails in another.
An execution graph represents an agent or workflow as a directed graph of nodes (model calls, tool runs, validators, or human gates) connected by edges that define how state flows from one step to the next. Conditional edges route execution based on runtime outputs, and cycles allow an agent to loop back and retry or refine work. Unlike a flat script, a graph makes state transitions, branching, and pause points explicit and inspectable.
- Why it matters
- Modeling complex agent behavior as an explicit state graph makes control flow, interrupts, retries, and observability far easier to reason about than deeply nested callbacks or ad-hoc
whileloops. - In Bruce
- Bruce runs on LangGraph state graphs under the hood (for example, dedicated graphs for outreach planning and chat sessions), and interactive chat turns follow a model-driven step plan rather than compiling a bespoke dynamic DAG per request.
A handoff is the explicit transfer of active control and scoped context from one agent to another specialized agent (or from an agent to a human). In multi-agent frameworks, a triage or lead agent hands off a conversation when a request crosses into another domain with different instructions, tools, or permissions. A clean handoff specifies both what context carries forward and what authority transfers.
- Why it matters
- Unstructured handoffs either dump noisy full histories onto the receiving agent or drop key constraints, causing repeated questions or contradictory actions.
An orchestrator is the coordinating component (either deterministic code or a lead language model) that breaks an incoming objective into subtasks, routes each subtask to specialized workers or sub-agents, tracks progress, and synthesizes their outputs into a final result. In the orchestrator-worker pattern, the orchestrator holds the big-picture plan while workers stay focused on narrow, well-scoped jobs. It decides when parallel branches are done and whether another round of investigation is needed.
- Why it matters
- Centralizing coordination prevents specialized agents from stepping on each other's state, duplicating expensive tool calls, or returning conflicting answers to the user. See Multi-Agent Orchestration.
A sub-agent is a subordinate agent spawned by a parent agent to execute a bounded task inside its own isolated context window and toolset, returning only a concise result to the parent. Sub-agents are used both to keep verbose intermediate work (like searching dozens of files or researching multiple leads) out of the parent's context and to fan out independent work in parallel. Crucially, a sub-agent's tool list should be scoped down to only what its narrow job requires.
- Why it matters
- Sub-agents protect the main conversation from context rot and speed up parallelizable work, but poorly isolated sub-agents can silently bypass approval gates that only run on the parent.
- In Bruce
- Bruce declares explicit sub-agents (including a general-purpose helper and a parallel sandbox slide editor for multi-slide decks). The slide-editor sub-agent is deliberately given an empty custom tool list so it receives only sandbox filesystem and shell tools and cannot inherit CRM write tools outside the parent's approval middleware.
Evaluation and evals
6 termsProduction workflows need high pass^k consistency, not just one lucky pass@k run.
An eval (evaluation) is an automated test that runs an AI model, prompt, or full agent against defined inputs and grades the resulting behavior or final state using deterministic checks, model-based rubrics, or human review. Unlike traditional unit tests that assert exact string equality, agent evals measure quality, tool accuracy, policy compliance, and outcome correctness across probabilistic outputs. Teams use evals both to measure new capabilities and to verify that prompt or model changes did not break existing behavior.
- Why it matters
- Without repeatable evals, every prompt edit or model upgrade is guesswork. Teams rely on vibes from three manual tests and discover regressions from customers in production.
- In Bruce
- Bruce splits evals into two layers: fast single-call call-site evals that replay pinned, redacted production prompts against candidate models, and heavier end-to-end surface suites that run a full graph. Bruce does not yet have automated evals measuring downstream business outcomes.
An eval set is a curated, versioned collection of test cases (inputs, fixture state, and expected outcomes or grading rubrics) used to benchmark an agent repeatedly over time. Strong eval sets mix real, redacted production tasks with tricky edge cases and known failure modes, and their inputs stay pinned so scores remain comparable across weeks. As an agent masters difficult capability cases, teams graduate those cases into permanent regression eval sets.
- Why it matters
- If test inputs drift underneath an eval or consist only of toy synthetic examples, rising scores mean nothing. A pinned eval set drawn from real failures is the ground truth for model swaps and harness changes.
- In Bruce
- Bruce's tool-trigger eval set contains 225 committed JSON cases replayed through the chat ask endpoint to verify expected tool selection and required arguments. These suites currently run manually before major changes rather than as an automated CI gate.
LLM as judge is an evaluation technique in which a strong language model scores another model's or agent's output against an explicit grading rubric, reference answer, or pairwise comparison. It scales to open-ended tasks where exact string matching fails, such as summarizing a call, drafting an email, or checking whether a response followed nuanced tone rules. Because model judges exhibit known biases (favoring longer answers, certain positions, or their own style), engineers pair them with deterministic checks and calibrate them against human ratings.
- Why it matters
- Human grading is too slow to run on every prompt tweak, while regexes cannot judge prose quality. A calibrated model judge bridges the gap, provided teams never let a high judge score override a deterministic schema or policy failure.
Because agents are non-deterministic, a single test run rarely tells the whole story; engineers use two complementary multi-trial metrics. Pass@k measures the probability that at least one of k independent attempts succeeds, which captures whether an agent is capable of solving a task at all. Pass^k (pass to the power of k) measures the probability that all k independent attempts succeed, which captures consistency for customer-facing workflows where reliability on every run matters.
- Why it matters
- An agent with a 75% single-trial success rate looks great on pass@5 (99.9%) but fails on pass^5 (23.7%). Production enterprise workflows need high pass^k, not just impressive best-of-k demos.
A regression eval is a suite of previously solved, high-priority test cases that an agent is expected to pass at or near 100% after every prompt, tool, or model change. While capability evals probe harder tasks where pass rates start low, regression evals guard the floor and catch silent breakages when a fix in one area degrades another. Anytime a production bug is fixed, adding a minimal case to the regression eval prevents it from returning.
- Why it matters
- Prompts and models interact in non-local ways: tightening one instruction can quietly break tool selection on an unrelated workflow. Regression evals make model swaps and prompt refactors safe to ship.
A trajectory eval grades the full sequence of intermediate steps an agent took (reasoning traces, tool choices, arguments, retries, and policy checks) rather than inspecting only the final text reply. An agent can arrive at the right final answer by accident after making unsafe, redundant, or wildly expensive tool calls; trajectory evals catch those defects immediately. They also reveal which specific turn went wrong when a multi-step task fails.
- Why it matters
- Final-answer grading hides wasted steps, wrong tool arguments, and bypassed guardrails. Grading the trajectory is how engineers make multi-turn loops efficient and predictable.
- In Bruce
- Bruce separates single-turn call-site evals from trajectory testing, using a dedicated planner trajectory suite to replay and grade multi-step outreach planner loops end to end.
Safety and guardrails
6 termsA guardrail is a programmatic check, classifier, or runtime rule placed around an agent's inputs, tool calls, or outputs to prevent unsafe, off-policy, or destructive behavior. Guardrails can run deterministically (validating arguments, blocking forbidden SQL statements, redacting secrets) or probabilistically (a fast classifier flagging prompt injection or PII before output reaches a user). Effective guardrails enforce hard limits in code outside the model rather than relying solely on instructions inside the system prompt.
- Why it matters
- Language models can be persuaded, confused, or distracted under edge-case inputs. Code-level guardrails guarantee that critical boundaries hold even when the model makes a mistake. See Designing Guardrails for Autonomous Agents.
- In Bruce
- Bruce enforces write and SQL guardrails in runtime code outside the prompt: declared SQL entry points refuse data-mutating SQL outright without offering an approval card, and an outbound touch guard hard-stops do-not-contact addresses on CC even after human approval.
Indirect prompt injection is an attack in which malicious instructions are planted inside untrusted external data that an agent reads during a task, such as an incoming email, a web page, a PDF attachment, or a CRM note. When the model ingests that external text alongside its system prompt, it may mistake attacker-supplied instructions for legitimate user commands and exfiltrate data or trigger unauthorized tools. Unlike direct injection from the active user, indirect injection hits honest users doing routine work.
- Why it matters
- Any agent that reads the open web, shared inboxes, or customer-submitted documents is exposed to untrusted input. Defenses require strict separation of privilege, minimal tool scopes, and runtime approval gates on state-changing actions rather than trusting the model to ignore hidden text.
Least privilege is the security principle of granting a user, service, or agent only the minimum permissions, data scopes, and tool capabilities required to perform its specific job, and nothing more. Applied to agents, it means scoping credentials to one organization or task, separating read-only tools from write tools, and issuing short-lived, narrowly scoped tokens instead of shared admin keys. Even if a model makes a bad decision or encounters prompt injection, least privilege limits the blast radius.
- Why it matters
- Giving an agent a blanket admin API token turns any reasoning mistake into a company-wide incident. Narrow, scoped authority keeps errors contained and recoverable.
Prompt injection is a vulnerability where crafted input overrides or subverts a language model's intended instructions, causing it to ignore constraints, leak confidential context, or invoke tools in unintended ways. It works because language models process system instructions and untrusted text inside the same shared token stream without a hardware-level boundary between code and data. It consistently ranks as the top security risk in OWASP's guidance for LLM applications.
- Why it matters
- Prompt engineering alone cannot solve prompt injection. Security-sensitive rules (access control, tenant isolation, write permissions, secret handling) must be enforced in deterministic application code outside the model.
Red teaming is structured adversarial testing in which humans or automated attacker models probe an agent to uncover failure modes, policy bypasses, prompt injections, data leaks, or unintended tool actions before release. Unlike standard evals that test expected user workflows, red teaming deliberately targets edge cases, multi-turn social engineering, and chained tool exploits. Findings feed directly back into runtime guardrails and regression eval sets.
- Why it matters
- Normal QA tests whether an agent works when used politely. Red teaming tests whether safety boundaries hold when inputs are hostile, malformed, or manipulative.
A sandbox is an isolated execution environment (such as a container, microVM, or OS-level namespace jail) where model-generated code or untrusted tools run with restricted access to the host filesystem, secrets, and other tenants. If generated code crashes, enters an infinite loop, or behaves unexpectedly, the sandbox contains the failure and resets cleanly between runs. Strong sandboxes keep credentials out of model-visible output and dispose of containers on a strict lifecycle.
- Why it matters
- Running LLM-generated code directly on an application server exposes host files, environment variables, and neighboring customers' data. Sandboxing is the baseline requirement for safe code execution.
- In Bruce
- Model-written Python executes inside an
ipyboxDocker sandbox where credentials are masked out of stdout, stderr, and logs before anything returns to the model, and source code is scanned before running so CRM writes pause for approval. Bruce does not currently enforce an outbound network egress allowlist on the sandbox. See Security.
Human in the loop and governance
5 termsAn audit trail is a chronological, tamper-evident record of security-relevant and state-changing events that lets an organization reconstruct who requested an action, what the agent proposed, which policy or human approved or refused it, and what changed in external systems. Unlike unstructured debug logs, an audit trail links identity, authority, input context, and final effect in a queryable record. It is essential for incident response, compliance reviews, and building operator trust.
- Why it matters
- Enterprises will not delegate real operational authority to an agent if nobody can answer "who approved this invoice change and why?" three weeks later.
- In Bruce
- Bruce writes structured records for effector-wrapped external writes in its side-effect ledger, audited write refusals across governed gates (such as CRM, routine, and outbound email gates), policy-table overrides, and the exact memory IDs recalled on each turn. Lightweight workspace actions outside those gates (such as calendar refusals) are not currently written to the refusal audit log.
Escalation is the explicit handoff of a blocked, ambiguous, high-risk, or policy-restricted decision from an autonomous agent to a human operator. A well-designed escalation packages the relevant context, what the agent already checked, the specific decision needed, and clear next actions rather than dumping a raw 50-turn transcript into chat. Clear escalation triggers prevent agents from guessing on high-stakes calls or looping endlessly when stuck.
- Why it matters
- Reliable autonomy depends on knowing when to stop. Clean escalations let small teams supervise dozens of running workflows by exception instead of babysitting every step.
Human in the loop (HITL) is an architectural pattern that pauses an agent at defined decision boundaries so a person can review, approve, edit, or reject an action before execution continues. Modern agent frameworks implement HITL using durable interrupts that serialize graph state while waiting for a human response, then resume from that exact point once a decision arrives. Good HITL focuses human attention on consequential, irreversible actions to avoid approval fatigue.
- Why it matters
- Asking a person to click approve on 200 harmless reads trains them to rubber-stamp everything; skipping human review on external emails, wire changes, or CRM overwrites invites costly errors.
- In Bruce
- Sensitive CRM writes and explicit workflow gates trigger a durable LangGraph interrupt backed by PostgreSQL, rendering an Approve or Decline card that survives a closed browser tab. In unattended channels or scheduled routines where no interactive card can be answered, the gate degrades cleanly instead of hanging indefinitely.
Permissions define what actions an agent or user is allowed to perform across systems (typically expressed as deny, ask, or allow rules scoped by organization, role, user, or action type). Approvals are the runtime sign-off records confirming that an authorized human reviewed and permitted a specific proposed action before it ran. Binding an approval to the exact payload being executed prevents a race or prompt change from altering an action after a human clicks approve.
- Why it matters
- Tool availability is not authorization. Separating fine-grained permissions from per-action approvals lets organizations start cautiously with human sign-off and selectively grant autonomy where trust is earned.
- In Bruce
- Bruce resolves write permissions on governed surfaces in a fixed precedence order across organization, role fallback, person, agent, and routine layers using
deny,ask, andautomodes, where an organizationdenyalways wins. When a chat approval carries an action hash, the write gate re-hashes the call and refuses it if the action changed after approval; decisions that arrive without a hash are counted rather than refused.
Policy enforcement is the architectural separation between deciding whether an action is permitted (a policy decision point) and executing the action (a policy enforcement point) in deterministic runtime code. Instead of hoping a language model remembers a compliance rule buried in a system prompt, every sensitive call passes through a central code gate that returns allow, ask, or deny and blocks unauthorized execution unconditionally. Policies can then be updated, audited, and revoked centrally without editing prompts.
- Why it matters
- Prompt instructions are advisory; code-level policy enforcement is binding. Enterprise governance requires boundaries that hold across every surface, channel, and model version.
- In Bruce
- Governed write gates (the CRM write gate, routine write guard, outbound touch guard, and effector) consult one central policy function in code (
decide()), enforcedenyandholdverdicts, and record refusals across those audited gates. Some workspace paths (including calendar writes, Gmail read-state updates, and OneDrive writes) do not currently route throughdecide(), and calendar refusals are not audited. See How we arrived at a seven-plane harness for enterprise.
Reliability and observability
6 termsA circuit breaker is a protective mechanism that automatically stops an agent or service from repeating failing calls, spinning in infinite tool loops, or burning through a budget ceiling. Borrowed from electrical engineering and distributed systems, it tracks failures, step counts, or spend against a threshold and trips open to halt execution cleanly rather than letting a runaway loop hammer downstream APIs. Once tripped, the system surfaces a clear failure or escalates to a person.
- Why it matters
- An unconstrained agent hitting a flaky API or misunderstanding an error message can burn through hundreds of model calls and rate limits in minutes. Explicit step caps and spend meters bound worst-case damage.
- In Bruce
- Bruce caps interactive chat loops with a graph recursion limit and meters routine runs with a per-run dollar budget that refuses the next tool call between steps once the configured limit is reached.
Idempotency is the property that executing the same operation multiple times with the same idempotency key produces the same result as executing it once, without creating duplicate side effects. In agent systems, timeouts, network drops, and double-clicks happen constantly; if an agent retries "send invoice" or "create purchase order" without an idempotency key, customers get billed or emailed twice. True idempotency pairs a unique operation key with state tracking and reconciliation when an outcome is uncertain.
- Why it matters
- Network timeouts do not mean a write failed; they mean the caller does not know whether the remote system applied it. Blind retries on non-idempotent writes are one of the fastest ways an agent causes real financial damage.
- In Bruce
- Effector-wrapped external writes claim a unique
(org, key)ledger row before calling the downstream system. A completed key replays its stored result, while a timeout marks the rowUNKNOWNso Bruce refuses blind retries and reconciles against the target system where a lookup exists (such as querying QuickBooks by document number). Sandbox writes are recorded after execution rather than claimed before write.
Observability is the ability to understand an agent's internal behavior, performance, and failure modes in production from the external telemetry it emits: structured traces, metrics, token counts, latency histograms, tool results, and audit records. Because agents generate dynamic execution paths at runtime, static application logs alone rarely explain why an agent chose a wrong tool or gave a bad answer. Good observability connects every user-visible output back to the exact prompts, retrieved context, model calls, and tool responses that produced it.
- Why it matters
- You cannot improve or debug a probabilistic multi-step system you cannot inspect. Observability turns mysterious "the AI acted weird" reports into concrete, reproducible engineering issues.
- In Bruce
- Bruce emits full LangSmith traces, per-turn telemetry capturing which memory and rule IDs were recalled, and per-organization usage records across both LLMs and external tool APIs.
Retry and backoff is a resilience pattern for handling transient failures (such as HTTP 429 rate limits or temporary 5xx timeouts) by re-attempting the call after progressively longer delays (exponential backoff) plus randomized jitter. Jitter spreads retries across time so hundreds of concurrent workers do not hammer a recovering API in lockstep (a thundering herd). Retries must always be capped and restricted strictly to safe, transient errors, never blind-retrying permanent auth failures or non-idempotent writes.
- Why it matters
- Agent workloads chain many external API calls per task, so transient hiccups are routine rather than exceptional. Smart retry policies recover quietly without triggering cascades or duplicate mutations.
A span is the basic building block of distributed tracing, representing a single named unit of work with a start time, duration, status, and structured metadata (attributes). In an agent system, one LLM inference call, one memory lookup, one guardrail check, or one external tool execution is recorded as its own span. Spans nest in parent-child relationships so engineers can see exactly which sub-operation consumed time or raised an error.
- Why it matters
- Measuring only total turn duration hides whether a 12-second response spent 9 seconds waiting on a slow ERP query, 2 seconds on model reasoning, or 1 second serializing tool schemas.
A trace is the complete, tree-structured record of all spans belonging to a single end-to-end request or agent run, stitched together by a shared trace identifier. Opening a trace shows the exact timeline of system prompt assembly, recalled memories, every model generation, every tool call and return payload, sub-agent branches, and final output. Traces are the primary debugging artifact for agent engineers and the main source of real cases for new eval sets.
- Why it matters
- Multi-step agent failures are almost always causal chains across turns. Reading the trace lets an engineer pinpoint the exact step where context went missing or a tool returned misleading data.
Models, outputs, and serving
8 termsCost per task is the total dollar cost required for an agent to complete one end-to-end job successfully, summing input tokens, cached input reads, output tokens, hidden reasoning tokens, retries, sub-agents, and external tool or API fees. Unlike a model's list price per million tokens, cost per task reflects how many loop iterations and context re-reads the agent actually needed to finish. A cheaper per-token model that takes twice as many steps or fails and retries often ends up with a higher cost per task than a stronger model.
- Why it matters
- Per-token pricing misleads teams optimizing production agents. Measuring cost per completed task alongside accuracy reveals true unit economics and exposes runaway context growth.
- In Bruce
- Bruce meters LLM tokens (including cached input rates) and third-party tool usage per organization, and supports per-run dollar limits on scheduled routines that refuse the next tool call once spending reaches the configured cap (without interrupting a call already in flight).
Grounding is the practice of anchoring a language model's statements, numbers, and decisions to verifiable external sources (such as live database queries, retrieved documents, or tool outputs) rather than parametric knowledge memorized during training. Grounded agents cite or retain links to the records they read so both the model and human reviewers can check claims against the source of truth. Strong grounding also instructs the model to report missing evidence instead of filling gaps by guessing.
- Why it matters
- Business users rely on agents for exact figures, customer history, and policy terms. Ungrounded answers that sound plausible are worse than saying "I could not find that record."
A hallucination (called confabulation in NIST's AI risk taxonomy) is output generated by a language model that is fluent and confident yet factually false, unverified, or unsupported by its input context. In agent systems, hallucinations are not just wrong text in a paragraph; a model can hallucinate a non-existent tool parameter, invent an account ID, or claim it updated a CRM record when the tool call actually failed. Grounding, strict schemas, and outcome verification are the main defenses.
- Why it matters
- A hallucinated claim in a chat box misleads a reader; a hallucinated argument or false confirmation inside an autonomous workflow corrupts live business systems.
Latency measures how long a user or workflow waits for an agent to respond, tracked at two distinct points: time to first token (TTFT), which governs how responsive a streaming interface feels, and end-to-end latency, which measures the full wall-clock duration across every model hop and tool call until the task completes. Agent workloads often show wide variance between median (p50) and tail (p95 or p99) latency because harder tasks trigger deeper loops or slow external APIs.
- Why it matters
- High TTFT makes interactive chat feel broken, while high end-to-end latency stalls real-time workflows like voice or live customer support. Engineers optimize both through prompt caching, streaming, parallel tool calls, and model routing.
Model routing is the practice of dynamically dispatching different requests or steps inside an agent to different language models based on task complexity, latency budget, cost, or required capabilities. A system might send simple classification, routing, or extraction steps to a fast, inexpensive model while reserving frontier reasoning models for complex multi-step planning or synthesis. Routing can be rule-based (by call site or surface) or driven by a lightweight classifier.
- Why it matters
- Sending every routine check to the largest frontier model wastes money and slows users down, while forcing every complex task onto a small model hurts accuracy. Routing matches model strength to each step's difficulty.
- In Bruce
- Bruce routes different surfaces through named model presets (separating main chat reasoning, low-latency voice turns, and a dedicated decision model preset for typed classification) so each surface can upgrade or swap models independently after parity evals.
Structured output constrains a language model's generation to conform strictly to a predefined schema (typically JSON Schema), often enforced directly during token decoding via constrained sampling rather than hoping the model follows formatting instructions in prose. Unlike loose JSON mode, which only guarantees syntactically valid JSON, structured output guarantees that required keys, nested objects, enums, and value types match the contract. This eliminates fragile regex parsing and malformed JSON retries.
- Why it matters
- Whenever downstream code, a database insert, or a classifier consumes a model's response directly, schema adherence turns unpredictable text into a reliable software interface.
- In Bruce
- Typed extraction and classification call sites use structured-output bindings (
with_structured_output) to enforce explicit response schemas before downstream logic consumes the result.
Temperature is a decoding parameter that scales the model's next-token probability distribution before sampling. Lower values (near 0) sharpen the distribution so the model consistently picks the highest-probability tokens, yielding more focused and repeatable outputs; higher values flatten the distribution, increasing variety and randomness at the risk of off-track or invalid output. Note that even temperature 0 is not guaranteed to be bitwise deterministic across distributed GPU serving, and several newer reasoning models fix or omit temperature altogether.
- Why it matters
- Agent engineering favors low temperatures for tool calling, extraction, and structured reasoning where predictability beats novelty, reserving higher values strictly for open-ended creative drafting.
A token is the basic unit of text (a common word, subword chunk, punctuation mark, or byte sequence) into which a language model's tokenizer splits input and output strings. In English prose, one token is roughly three-quarters of a word (about four characters), though code, JSON, and non-English scripts often tokenize into more tokens per character. Context window limits, prompt caching thresholds, serving throughput, and API bills are all measured in tokens rather than words or characters.
- Why it matters
- Token counts govern both the cost and the speed of every agent step. Verbose JSON tool payloads and bloated tool schemas inflate token usage far faster than human-readable prose, silently multiplying cost per task across a loop.


