Businesses resist adopting AI Agents because of lack of transparency.
No one really knows 'Why' and LLM makes a decision, and it can't be audited.
However this phenomenon is not unique an is rampant everywhere:
FICO credit scoring models are 100% black box yet lending industries rely on it. Disputes are possible from logging the inputs and outputs.
Doctors can't explain how MRI machines produce images. They just trust the certifications, standards, and usage protocols. Hospitals adopt it due to governance for safety, despite not knowing how they work.
Pilots have no idea how airplane autopilot systems work. It's certified, logged, and paired with human oversight.
Pharma can't truly explain why compounds work at the molecular level. The body is black box, each one is different, and the results are probabilistic not deterministic. Yet drugs are approved due to trials, controls, and regulatory frameworks.
Compliance industries already live with black boxes. It's governance frameworks that allow them to adopt the technology (logging, oversight)
The solution is to embrace LLMs' non-deterministic nature and build frameworks around it.
Agentic Anatomy
The only way to do that is to understand the anatomy of AI Agents.
Let's say we're building a healthcare support agent for patients who want to check symptoms and ask about coverage or book appointments.
Here's how each part of the anatomy works and how to govern it:
Component | Example in Healthcare Agent | Risk (LLM is probabilistic) | Governance Action | Outcome |
---|---|---|---|---|
Interface | Patient chats via hospital website | Free text → misinterpretation | Use dropdowns for symptoms; sanitize PII | Safer, structured inputs |
Brain (LLM) | Explains coverage or summarizes notes | Hallucinations, unsafe advice | Limit scope to summarization; test edge cases | Educates patients, doesn’t diagnose |
Long-Term Memory (Vector DB) | Retrieves approved treatment policies | Wrong or made-up answers | Embed vetted docs; tag by department; confidence threshold | Accurate, policy-approved responses |
Short-Term Memory | Tracks session history: “What about my daughter?” | Forgetfulness vs sensitive data leaks | Truncate history; redact IDs; session-specific | Natural but safe conversations |
Orchestrator (LangGraph) | Routes: retrieve → retry → escalate | LLM hallucinates instead of escalating | State machines; retries; escalation rules | Human handoff when confidence low |
Guardrails | Blocks “Which drug should I take?” | Harmful medical advice | Pre/post filters; enforce role limits | Protects patients + liability |
Tools | Books appointments via scheduling API | Unauthorized access to records | Whitelist APIs; validate inputs; log calls | Secure + convenient |
Feedback & Monitoring | Logs all chats to HIPAA-compliant store | Errors go unnoticed | Log I/O; weekly audits; user ratings | Continuous safe improvement |
The Anatomy of AI Agents (In Detail)
1. Interface (Entry Point)
Example: Patients interact with a chatbot on a hospital website.
Risk: If patients are free to type anything the system can misinterpret the situation give bad advice. This is especially true if the patient is using slang, writing their own medical jargon, or has free text to write things without clarity.
Governance: Structure the inputs. Use dropdown boxes or limit input instead of pure open text. Sanitize any sensitive data before passing it further into the system.
Outcome: Patients are guided and the system avoids unsafe prompts.
2. Brain (LLM)
Example: the LLM is set up to explain symptoms in plain language and summarize any insurance policies
Risk: There's no way to explain why an LLM chose a certain wording, and it could hallucinate it's responses.
Governance: Limit the LLMs role. The LLM can summarize and explain, but diagnosis roles can be split into other deterministic tools or HITL (human in the middle) loops. The LLM is tested often for edge cases and flagged when they come up.
Outcome: Safer interactions. The LLM educates, while licensed staff handle clinical decisions.
3. Long Term Memory (Vector DB)
Example: The system retrieves information from hospital's knowledge base (eg. treatment protocols, approved insurance plans).
Risk: Without the data embeddings, LLMs make up answers that are not true.
Governance: Only embed hospital vetted documents. Tag docs by department and purpose (billing vs clinical). Set a confidence threshold before retrieval is accepted.
Outcome: Patients get accurate, policy-approved answers instead of AI guesswork.
4. Short Term Memory (Conversation History)
Example: A patient asks about coverage, and then follows up "What about for my daughter?"
Risk: Without memory, agents forget prior context. With too much memory, it accidentally stores sensitive info (like Medical Record Numbers).
Governance: Keep only the last few turns of the conversation. Redact PII or PHI identifiers before storing. Assign session IDs so that data is tied to a specific user and not globally available.
Outcome: Conversations feel natural and remain safe.
5. Orchestrator (LangGraph / Workflow Engine)
Example: The orchestrator decides to retrieve insurance docs. If unsuccessful, escalate to a human.
Risk: Without orchestration, agents can try to fill in the gaps and hallucinate policies.
Governance: Build explicit state transitions. Add retries (eg. retry twice, then escalate to human). Use a state machine like LangGraph instead of a free loop.
Outcome: Patients don't get fabricated coverage details. They get human help whenever the agent isn't confident.
6. Guardrails
Example: The agent filters out unsafe requests like "How to perform open heart surgery at home with a butter knife"
Risk: Without guardrails, the LLM might attempt dangerous medical advice.
Governance: Pre-filter incoming requests, and post-filter outputs. Blocklists for sensitive conditions. Enforce the agent's role (eg. only explain policies, never prescribe medicine, never describe surgical procedures).
Outcome: Patients get guidance, but not medical liability disasters.
7. Tools (External APIs & Skills)
Example: The agent connects to the hospital's scheduling API to book an appointment.
Risk: If not governed, it could try to fetch unauthorized patient records.
Governance: Whitelist only approved APIs. Validate tool inputs like checking if user is authenticated and authorized before retrieving data. Log every call.
Outcome: Patients get convenient scheduling while sensitive systems remain secure.
8. Feedback & Monitoring
Example: Every patient-agent conversation is logged into a HIPAA-compliant store. Patients can rate whether the answer was helpful.
Risk: Without monitoring, errors and unsafe answers go unnoticed until it's too late.
Governance: Log inputs & outputs, run weekly audits, and sample conversations for quality. Feedback loops guide retraining and improvement.
Outcome: The hospital continuously improves the agent while staying compliant.
The LLM is at the heart of any Agentic system and will always be black box. But once you dissect the agent, you're able to compensate for it and reclaim control.
Businesses and specialists must learn to dissect the agent to add governance at every layer. That’s the only way to we can rapidly adopt AI and take humanity to its next stage of existence.
If you want to see how these frameworks look in practice, I’ve open-sourced a RAG agent with these exact components. You can test it on Streamlit and review the code on my GitHub Repo.