pvakati-tech.ai
Reference Architecture

Agentic AI Architecture

These patterns show how to structure agents that can plan, use tools, remember context, enforce policy, and safely execute work across commerce and healthcare drug e-commerce.

Back to topics
Experience layer: chat, search, internal console, support desk, mobile app, or external agent endpoint.
Reasoning layer: planner, task graph, memory, retrieval, and evaluator.
Tool layer: APIs for catalog, OMS, CRM, inventory, pricing, pharmacy, payer, carrier, and notification systems.
Control layer: identity, consent, RBAC, policy engine, human approval, audit log, observability, and rollback.

Flow 1: E-commerce shopping agent

A controlled shopping agent should be able to search, compare, build a cart, and ask for approval without silently executing risky actions.

Customer intent

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

Planner

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

Tool gateway

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

Policy guard

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

Human approval

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

Flow 2: Healthcare drug e-commerce agent

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

Patient request

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

Identity and consent

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

Clinical policy router

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

Pharmacy tools

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

Escalation or action

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

Flow 3: Multi-agent orchestration

Use a supervisor agent when multiple specialists need to coordinate across search, support, merchandising, fulfillment, and compliance.

Supervisor agent

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

Specialist agents

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

Shared memory

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

Evaluation loop

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

Controlled execution

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

Implementation examples

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

Commerce example: gift basket agent

User asks for a birthday gift basket under $120 delivered by Friday.

Planner searches products, checks inventory by ZIP code, applies promo and delivery constraints.

Guardrail blocks unavailable substitutions and requires approval before checkout.

Agent presents two baskets, trade-offs, final price, and asks whether to place the order.

Drug commerce example: refill and delivery agent

Patient asks to refill a maintenance medication and ship it before travel.

Agent verifies identity, prescription ownership, refill eligibility, copay, and inventory.

If refill is valid, agent prepares the order; if prior authorization is missing, it routes the packet.

Pharmacist review is required for substitutions, interaction concerns, or clinical ambiguity.

Operations example: fulfillment exception agent

Carrier event indicates delivery risk for a temperature-sensitive product.

Agent checks shipment status, temperature data, replacement policy, and inventory.

It drafts customer notification and escalation summary for operations approval.

Approved action triggers replacement, refund, or pharmacist/customer outreach.

Build order

Start 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 architecture references

These references are useful for deeper architecture choices around patterns, memory, tools, multi-agent coordination, governance, and platform options.