KHEIREDDINE RIAHI

Reference technical architecture of an agentic AI system

AI ARCHITECTURE · REFERENCE DOCUMENT

Summary

1. Understanding agentic AI

2. The 36 technologies of the ecosystem

3. Technical reference architecture

4. RAG, GraphRAG and Neo4j

5. End-to-end example: processing a customer request

6. Choosing a technology stack

7. Security, governance and non-functional requirements

8. Production approach and industrialization

9. Glossary and key points for the architect

Agentic architecture with API Gateway, AI Gateway, LangGraph, LiteLLM and vLLM.
Agentic architecture with API Gateway, AI Gateway, LangGraph, LiteLLM and vLLM.

1. Understanding agentic AI

An LLM (Large Language Model) is a model capable of understanding and generating content. An AI agent uses one or more models to pursue a goal: it interprets a request, plans steps, selects tools, executes actions, observes the results and can adjust its plan. A multi-agent system distributes work between several specialized agents.

Concept

Definition

Example

LLM

Language model that generates or analyzes content.

GPT answers a question.

AI agent

Decision loop that combines model, instructions, state and tools.

An agent consults a file and then creates a task.

Multi-agent

Multiple coordinated agents, with distinct roles.

Research, analysis, validation and writing.

Workflow

Explicit sequence of steps, rules and transitions.

Check a file then request approval.

RAG

Search for external knowledge to enrich the model context.

Find useful passages in a contract.

GraphRAG

Search using the entities and relationships of a knowledge graph.

Identify dependencies between customer, contract and warranty.

Takeaway
An agent is not just a chatbot. As soon as it can act on an IS, it is necessary to regulate its tools, its rights, its limits, its validations, its traceability and its recovery mechanisms.

2. The 36 technologies of the ecosystem

The list below includes the 36 elements of the initial infographic. She classifies them by role. Some elements are frameworks, others models, inference engines, memory platforms or observability tools: they are therefore not all competitors.

2.1 Frameworks and orchestration — 12 technologies

Technology

Definition

Main utility

Example

1. LangGraph

Orchestration framework based on graphs and explicit state.

Workflows with branches, loops, checkpoints, restarts and human validations.

Disaster handler with conditional steps.

2. OpenAI Agents SDK

SDK to create agents with tools, delegation and guardrails.

Handoffs between agents, tool calling, sessions and traces.

A support agent delegates technical analysis to a specialized agent.

3. Claude Agent SDK

SDK giving access to the agentic capabilities of Claude Code.

Agents manipulating files, commands and tools within a permissions framework.

Analysis of a code repository and proposal for a fix.

4. Google ADK

Agent Development Kit from Google for developing agents and multi-agent systems.

Sequential, parallel or hierarchical agents, Google Cloud integration.

A supervisor distributes searches to multiple agents.

5. Microsoft Agent Framework

Microsoft framework for building agents and workflows, following on from AutoGen and Semantic Kernel.

Orchestration, middleware and .NET/Python and Microsoft integration.

Agents integrated into an Azure and .NET IS.

6. CrewAI

Framework for agent teams structured by roles and objectives.

Collaboration of specialists with distinct tasks and responsibilities.

Market analyst, financial analyst and writer.

7. Pydantic AI

Python framework with emphasis on types and structured output.

Validation of I/O, dependencies and data contracts.

Generation of a JSON object conforming to the business model.

8. Mastra

TypeScript framework for agents, workflows, memory and evaluations.

Development of agentic applications in the JavaScript ecosystem.

Business assistant in a Node.js application.

9. Vercel AI SDK

TypeScript library for integrating AI models and interactions into applications.

Streaming, model calls, tools and user interface.

Next.js conversational assistant.

10. LlamaIndex

Data-driven framework for connecting LLMs to information sources.

Ingestion, parsing, indexing, retrieval, RAG and data-driven agents.

Wizard querying internal documentation.

11. Strands Agents

AWS open source agentic framework, driven by an agent loop.

Agents using tools and templates in AWS or hybrid environments.

Cloud Infrastructure Diagnostic Agent.

12. smolagents

Hugging Face's lightweight framework for creating Python agents.

Prototyping agents that can use tools and execute code.

Agent parsing a CSV file.

2.2 Models and runtime — 12 elements

Model families

Model

Definition

Utility

13. Claude

Anthropic model family.

Reasoning, programming, documentary analysis and use of tools.

14.GPT

OpenAI model family.

Generation, reasoning, multimodality and function calls.

15. Gemini

Google model family.

Text, image, audio, video and long contexts depending on the model.

16. Qwen

Alibaba Model Family.

Open or accessible models for language, code, vision and reasoning.

17. DeepSeek

DeepSeek Model Family.

Reasoning, code and open weight models.

18. GLM

Zhipu AI Model Family.

Language, reasoning, programming and agentic uses.

Serving, routing and execution

Technology

Definition

Utility

19. vLLM

Powerful LLM serving/inference engine.

Serving models on GPU with high throughput and concurrent query handling.

20. Ollama

Tool that simplifies the downloading and local execution of models.

Development, testing, PoC and simple local inference.

21. LiteLLM

SDK and proxy unifying access to many model providers.

Routing, fallback, budgets, keys, quotas and common interface.

22. OpenRouter

Hosted service for access and routing to many models.

Experiment and select models via a unified API.

23. Modal

Cloud platform for executing workloads, including GPU.

Deploy AI processing without directly administering the entire GPU infrastructure.

24. E2B

Isolated sandbox environments for running code.

Execute agent-generated code without running it in the main application server.

Important distinction
GPT, Claude, Gemini, Qwen, DeepSeek and GLM are model families. vLLM and Ollama are used to run models. LiteLLM and OpenRouter make access and routing easier. Modal provides cloud execution resources and E2B isolated environments.

2.3 Memory, evaluation and operations — 12 elements

Technology

Definition

Utility

25. Mem0

Memory layer that extracts, stores and retrieves useful information.

Preferences and useful facts of a user or session.

26. Letta

Framework for building persistent agents that manage their memory.

Agents capable of maintaining and updating a memory state.

27. Zep

Conversational memory and temporal knowledge platform.

Find facts and relationships that evolve over time.

28. LangSmith

Tracing, debugging and evaluation platform, associated with the LangChain ecosystem.

Understand the steps, LLM calls, tools and errors.

29. Langfuse

LLM/agents observability platform, available as open source.

Traces, prompts, tokens, costs, latency and sessions.

30. Braintrust

Platform for evaluating and improving AI applications.

Compare prompts, templates and versions from datasets.

31. Arize Phoenix

LLM application observability and assessment tool.

Analyze traces, RAG, relevance and agentic behavior.

32. Ragas

Framework for evaluating RAG systems and AI applications.

Measure relevance of context, fidelity and quality of responses.

33. DeepEval

Testing framework for LLM applications, close to pytest.

Automate quality and behavior testing in CI/CD.

34. promptfoo

Prompt testing tool, model comparison and red teaming.

Detect injection prompts, leaks and unwanted behavior.

35. Temporal

Sustainable execution platform for distributed workflows.

Retries, timeouts, crash recovery, and long-running processes.

36. Composio

Platform for connecting agents to external applications and services.

Integrate SaaS tools and manage connections/authentications.

3. Technical reference architecture

The target architecture separates responsibilities to limit the coupling between orchestration, models, data, business tools and infrastructure. Technologies are implementation options: it is not necessary to deploy them all.

Detailed view of multi-agent architecture with RAG and GraphRAG

Layer

Responsibility

Possible technologies

1. Channels and users

Web/mobile interfaces, client APIs, business users and support.

React, Angular, REST, GraphQL.

2. Exposure and Security

Point of entry, authentication, authorization, quotas, validation and audit.

API Gateway, OAuth2/OIDC, RBAC/ABAC, rate limiting.

3. Multi-agent orchestration

Scheduling, state, delegation, conditions, execution loop and human validation.

LangGraph, OpenAI Agents SDK, Google ADK, CrewAI.

4. Models and inference

Choice of model, cloud or on-premise access, serving and fallback.

LiteLLM, GPT/Claude/Gemini, Ollama, vLLM.

5. Knowledge and memory

Documentary research, relational research, conversational memory and business data.

LlamaIndex, Neo4j, pgvector/Milvus, Mem0/Zep, PostgreSQL.

6. IS Integration

Controlled access to APIs, tools, events and business systems.

MCP, REST API, Spring Boot, Kafka, ERP/CRM.

7. Observability and quality

Traces, metrics, logs, evaluation, security tests and audit.

Langfuse, LangSmith, Phoenix, Ragas, DeepEval, promptfoo.

8. Infrastructure and operations

Containers, orchestration, sustainable workflows, CI/CD and monitoring.

Docker, Kubernetes, Temporal, GitLab/GitHub CI/CD, Prometheus/Grafana.

3.1 Role of structuring components

LangGraph — orchestrator

Manages the execution graph: state, transitions, loops, conditions, checkpoints and possible human validation. It does not replace business APIs.

LlamaIndex — data/RAG layer

Connects sources, parses and slices documents, builds indexes and retrieves relevant passages. It can participate in RAG workflows and data-driven agents.

LiteLLM — Model Gateway

Provides a common access point for vendors and models. It can apply routing, fallback, budgets and policies. It does not replace the agentic orchestrator.

Ollama — local execution

Useful for developing and testing with local models. It is not automatically the best choice for a large-scale GPU serving platform.

vLLM — production serving

Suitable for exposing self-hosted models on GPU, especially when throughput and concurrency are important. It requires GPU mining capability.

MCP — Tool Integration

Standardizes the way a compatible client discovers and invokes tools or resources. REST APIs remain relevant for business contracts and traditional integrations.

Kafka — events

Decouples producers and consumers, transports business events and facilitates asynchronous processing. It is not a replacement for a sustainable workflow engine.

Temporal — durability

Handles long processes, restarts, retries and timeouts. LangGraph can carry agentic logic while Temporal carries the sustainability of a global process.

4. RAG, GraphRAG and Neo4j

RAG (Retrieval-Augmented Generation) enriches the context passed to the model by searching for information in external sources. GraphRAG adds an explicit representation of entities and their relationships. The two approaches are complementary.

4.1 Vector RAG

Collection: retrieve documents from EDM, SharePoint, Confluence, databases or files.

Parsing: extract text and metadata.

Chunking: cut content into segments suitable for search.

Embeddings: transform segments into digital vectors.

Indexing: store vectors and metadata in pgvector, Milvus, Weaviate or another vector base.

Retrieval: search for segments close to the question, then optionally rerank the results.

Augmentation: inject the passages retained in the context of the LLM with their references.

Generation: Produce a response based on the retrieved items.

4.2 GraphRAG and Neo4j

A Knowledge Graph represents business objects as nodes and relationships. Neo4j is a graph-oriented database that allows you to store and query these structures, particularly with the Cypher language.

Element

Bank example

Node

Customer, Credit, Contract, Guarantee, Rate, Agency.

Relationship

CUSTOMER_HOLDS_CREDIT, CREDIT_GUARANTEED_BY, RATE_APPLICABLE TO.

Property

Signature date, amount, status, maturity, rate.

Query

Which contracts linked to this customer are exposed to a rate increase?

4.3 Vector RAG and GraphRAG: comparison

Criterion

Vector RAG

GraphRAG / Knowledge Graph

Principle

Semantic similarity between query and passages.

Exploring entities and relationships.

Adapted data

Documents, paragraphs, FAQs, procedures.

Relational data, dependencies, entity networks.

Sample question

Where is the refund rule?

What products, contracts and guarantees are linked to this customer?

Force

Find relevant content even if the words differ.

Answer multi-relationship and contextualized questions.

Limit

May miss an implicit relationship or dependency chain.

Requires a quality graph and consistent modeling.

4.4 RAG + GraphRAG hybrid architecture

The “Knowledge & AI Data” block distinguishes documentary search and knowledge graph.

LlamaIndex ingests documents and prepares document indexes.

The extraction pipeline identifies useful entities, relationships, and metadata.

Neo4j stores knowledge graph; Cypher queries explore relevant relationships.

The vector base stores embeddings for semantic search.

The hybrid retrieval component combines documentary passages and graph results.

LangGraph passes the consolidated context to the analytics agent or business agent.

The LLM formulates a response with sources, limitations and supporting elements.

Design Point
Neo4j does not necessarily replace pgvector or Milvus. The graph answers relational questions; the vector base responds to similarity search. A hybrid architecture can use both.

4.5 Example Question GraphRAG

Question: “What risks are associated with this customer’s mortgage if rates increase?” »

The RAG finds the contract clauses, rate procedures and regulatory documents.

Neo4j links the customer to his credit, the credit to his rate, the credit to his guarantees and the guarantees to the contractual conditions.

The hybrid retrieval assembles documentary extracts and graph relationships.

An analysis agent reviews the scenarios and a compliance agent verifies the applicable rules.

An agent writes an explainable summary, with documentary references and hypotheses.

5. End-to-end example: processing a customer request

Use case: a customer requests reimbursement for an operation. The agent must analyze the file, consult the business data, check the rules and possibly trigger an action under control.

Step

Processing

Components

1. Receipt

The customer submits their request from the web portal or mobile application.

Web/mobile front

2. Security

The API Gateway authenticates the user, controls rights and enforces quotas.

API Gateway, OIDC, RBAC

3. Orchestration

LangGraph initializes the case state and chooses the necessary agents and steps.

LangGraph

4. Document search

The agent searches for useful procedures and contracts.

LlamaIndex + vector base

5. Relational search

The agent identifies the relationships between customer, order, payment and contract.

Neo4j / GraphRAG

6. Reasoning

The model analyzes the retrieved elements and identifies missing information.

LiteLLM + cloud or local model

7. Business tools

The agent consults the business APIs and can prepare an operation.

MCP and Spring Boot API

8. Validation

A sensitive operation is subject to human validation.

Human-in-the-loop

9. Execution

The authorized business service performs the operation and publishes an event.

Business API + Kafka

10. Traceability

Decisions, tools called, durations, costs and results are traced and evaluated.

Langfuse + evaluations

6. Choosing a technology stack

6.1 Prototype / MVP

Python + LangGraph for agentic workflow.

LlamaIndex for ingestion, indexing and RAG.

Ollama to locally test compatible models.

PostgreSQL + pgvector for data and vectors.

Neo4j only if the use case already requires complex relationships.

Langfuse for first traces and analyses.

6.2 Hybrid Enterprise Production

Spring Boot for Business Services and API Contracts.

Python + LangGraph for agentic orchestration.

LlamaIndex for the document ingestion and retrieval chain.

Neo4j for relational knowledge when business value is demonstrated.

LiteLLM as a gateway to cloud and self-hosted models.

GPT, Claude or Gemini for cloud models; vLLM to serve self-hosted models on GPU.

Ollama for local development and testing, rather than as an automatic production serving choice.

PostgreSQL, Redis and vector base depending on persistence, cache and search needs.

MCP and REST API for access to business tools and systems; Kafka for events.

Langfuse, Ragas, DeepEval and promptfoo for observability, evaluation and security testing.

Docker, Kubernetes and Temporal depending on deployment needs and sustainable workflows.

6.3 Sovereign / self-hosted infrastructure

LangGraph for orchestration.

Qwen, DeepSeek or GLM depending on evaluation results, license and constraints.

vLLM to serve models on GPU.

LlamaIndex for RAG pipelines.

Neo4j for business relationships and pgvector/Milvus for vector search.

Langfuse and Phoenix for supervision.

Kubernetes with GPU management, secrets, storage and networking.

Selection rule
Do not select a technology because it appears in a list. Start from the use case, data, level of risk, latency, volume, cost, sovereignty and available skills.

7. Security, governance and non-functional requirements

Domain

Actions to be taken

Identity and authorization

Strong authentication, OAuth2/OIDC, RBAC/ABAC, technical identity by service and least privilege.

Tool Rights

Explicitly authorize each tool, each action, and each data scope. Separate reading and writing.

Human validation

Require approval for payments, refunds, sensitive data changes, or irreversible actions.

Protection against prompt injection

Treat external documents and content as untrusted data; filter and control instructions.

Personal data

Minimization, encryption, retention, access control, logging and GDPR compliance.

Secrets

Never place API keys, passwords or tokens in prompts or traces; use a chest of secrets.

Traceability

Retain query IDs, prompt/template versions, called tools, decisions and results, with retention policy.

Resilience

Timeouts, bounded retries, idempotence, circuit breakers, fallback and workflow recovery.

Quality

Representative test sets, RAG evaluations, non-regression tests, adversarial tests and business validation.

Costs and performance

Track tokens, latency, failure rate, cost per task, GPU utilization and human utilization rate.

8. Implementation approach and industrialization

Phase

Deliverables / activities

Phase 1 — Scoping

Define users, objectives, scope, risks, data, authorized actions and success criteria.

Phase 2 — Architecture

Define components, flows, API contracts, security model, RAG/GraphRAG choice and cloud/on-premise strategy.

Phase 3 — Prototype

Build a simple agent, a first documentary retrieval and some read-only tools.

Phase 4 — Evaluation

Create a question/answer dataset, measure relevance, fidelity, accuracy, latency and costs.

Phase 5 — IS integration

Connect business APIs, MCP if relevant, Kafka events and identity management.

Phase 6 — Industrialization

Add secrets management, observability, security testing, CI/CD, containers and scalability.

Phase 7 — Phased production

Start in read-only or co-pilot mode, introduce actions with approval, then expand rights upon proof.

Phase 8 — Continuous Improvement

Analyze traces, correct errors, enrich data and re-evaluate each model or prompt change.

9. Glossary and key points for the architect

Term

Definition

Agent

Software component driven by a model, an objective, a state and tools.

Embedding

Numerical representation of content used for similarity search.

Vector store

Storage and indexing of vectors, often associated with metadata.

Knowledge Graph

Graph of entities, relationships, and properties representing a domain.

Cypher

Neo4j query language.

Chunking

Chunking documents into searchable segments.

Reranking

Reordering search results according to their relevance.

Tool calling

Mechanism by which a model requests the execution of a tool.

Handoff

Delegation of a task or control to another agent.

Checkpoint

Saved state allowing you to resume a workflow.

Human-in-the-loop

Human intervention in the decision or approval process.

MCP

Model Context Protocol: standardized access protocol to tools and resources.

Inference

Running a model to produce output from input.

Serving

Exposing a model via a service capable of processing requests.

Observability

Ability to understand internal behavior via traces, metrics and logs.

Guardrails

Controls that limit the inputs, outputs, and actions of AI systems.

The 10 technologies to explore as a priority

Priority

Technology

Why master it

1

LangGraph

Orchestration and control of workflows.

2

OpenAI Agents SDK

Agents, tools, delegation and guardrails.

3

MCP

Tool interoperability.

4

LlamaIndex

RAG and data exploitation.

5

Neo4j / GraphRAG

Relational knowledge and reasoning about links.

6

LiteLLM

Model abstraction and routing.

7

vLLM / Ollama

Production serving and local execution.

8

Mem0

Persistent memory.

9

Langfuse

Observability and traceability.

10

DeepEval / Ragas

Evaluation and testing.

Conclusion
An enterprise agentic platform is not a simple Python application connected to an LLM. It is a distributed system that combines orchestration, models, data, business tools, security, observability and operation. The architect's value consists of mastering the boundaries between these components, choosing the right technologies and guaranteeing an explainable, controlled, resilient and measurable system.

End of guide

Schematics and illustrations

Steps in the Retrieval-Augmented Generation pipeline.
Retrieval-Augmented Generation pipeline steps.