// reference_architecture

Agentic AI Architecture

A layered blueprint for agents that plan, use tools, remember context, enforce policy, and safely execute work — with reference flows for commerce, healthcare drug e-commerce, and multi-agent orchestration.

planner + task graphtool gatewaymemory + retrievalpolicy + approval
Back to topics
// the stack

Four layers, top to bottom

Every agentic system is a stack: an experience surface on top, reasoning beneath it, tools under that, and a control plane that governs all of it. The control layer is where safety lives — identity, policy, approval, and rollback.

L1Experience layer
ChatSearchInternal consoleSupport deskMobile appExternal agent endpoint
L2Reasoning layer
PlannerTask graphMemoryRetrievalEvaluator
L3Tool layer
CatalogOMSCRMInventoryPricingPharmacyPayerCarrierNotifications
L4Control layer
IdentityConsentRBACPolicy engineHuman approvalAudit logObservabilityRollback
// reference_flows

Three flows through the stack

The same layered blueprint, walked end to end for three real scenarios. Amber nodes are the deterministic control checkpoints — the agent can only propose; policy and humans decide what executes.

flow 01 · commerce

E-commerce shopping agent

A controlled shopping agent should search, compare, build a cart, and ask for approval — never silently execute risky actions.

01

Customer intent

Natural language goal, budget, constraints, loyalty context, and consent scope.

02

Planner

Breaks the shopping goal into search, compare, promotion, cart, and approval steps.

03

Tool gateway

Calls catalog, inventory, pricing, promotions, reviews, cart, and checkout APIs.

04 · CONTROL

Policy guard

Checks substitution limits, payment authorization, return rules, and brand policy.

05 · CONTROL

Human approval

Shows final cart, trade-offs, price, delivery promise, and asks before purchase.

flow 02 · healthcare

Healthcare drug e-commerce agent

Drug commerce agents need identity, consent, clinical routing, pharmacist escalation, and stronger audit than general retail.

01

Patient request

Refill, OTC product question, order status, copay issue, or delivery exception.

02 · CONTROL

Identity & consent

Verifies user, permission scope, prescription ownership, and communication channel.

03 · CONTROL

Clinical policy router

Separates safe commerce tasks from pharmacist, prescriber, or payer-required actions.

04

Pharmacy tools

Checks Rx status, formulary, inventory, interactions, delivery windows, and copay.

05

Escalation or action

Submits eligible refill, routes prior auth packet, or escalates clinical decisions.

flow 03 · orchestration

Multi-agent orchestration

Use a supervisor agent when specialists must coordinate across search, service, merchandising, fulfillment, and compliance.

01

Supervisor agent

Owns goal state, risk score, task decomposition, and final response assembly.

02

Specialist agents

Search, merchandising, service, fulfillment, compliance, and analytics agents.

03

Shared memory

Stores session state, user preferences, retrieved facts, tool results, and audit log.

04

Evaluation loop

Scores accuracy, policy compliance, tool success, latency, cost, and override rate.

05 · CONTROL

Controlled execution

Runs approved writes through permissions, idempotency, rollback, and monitoring.

// worked_examples

Implementation examples

Use these to decide which tools, policies, and approval gates belong in the first implementation slice.

Commerce · gift basket agent

  1. 01User asks for a birthday gift basket under $120 delivered by Friday.
  2. 02Planner searches products, checks inventory by ZIP code, applies promo and delivery constraints.
  3. 03Guardrail blocks unavailable substitutions and requires approval before checkout.
  4. 04Agent presents two baskets, trade-offs, final price, and asks whether to place the order.

Drug commerce · refill & delivery agent

  1. 01Patient asks to refill a maintenance medication and ship it before travel.
  2. 02Agent verifies identity, prescription ownership, refill eligibility, copay, and inventory.
  3. 03If refill is valid, agent prepares the order; if prior authorization is missing, it routes the packet.
  4. 04Pharmacist review is required for substitutions, interaction concerns, or clinical ambiguity.

Operations · fulfillment exception agent

  1. 01Carrier event indicates delivery risk for a temperature-sensitive product.
  2. 02Agent checks shipment status, temperature data, replacement policy, and inventory.
  3. 03It drafts customer notification and escalation summary for operations approval.
  4. 04Approved action triggers replacement, refund, or pharmacist/customer outreach.
// build_order

Start read-only, add writes last

Begin with read-only recommendations, then add approved writes, then automate low-risk actions. For healthcare drug commerce, keep pharmacist, prescriber, or payer checkpoints in place for regulated decisions.

// external_references

Deeper architecture reading

Useful for deeper choices around patterns, memory, tools, multi-agent coordination, governance, and platform options.