AI Academy/AI Foundations/Lesson 01
LESSON 01 · AI FOUNDATIONS

Know the AI Stack

An AI application is much more than a model call. Learn how models, instructions, context, retrieval, tools, memory, application logic, evaluation, security and operations work together to create a useful and reliable AI system.

Goal: Map the system35–45 minOutput: AI application architecture sketch
THE NELARA AI APPLICATION STACK

From user request to reliable AI outcome

A production AI application is more than a model. The interface, application logic, instructions, context, retrieval, tools, model, evaluation, security and operations work together to create a useful and reliable system.

01
User & Interface
Chat, application interface, workflow or business process that captures the user request.
02
Application Logic
Orchestration, business rules, routing, permissions and workflow control.
03
Instructions & Context
System instructions, task constraints, conversation context and relevant information.
04
Retrieval & Enterprise Data
Documents, databases, knowledge bases, APIs and retrieval systems that provide relevant information.
05
Tools & Actions
Search, APIs, calculators, databases and business actions that allow the AI system to do more than generate text.
AI
Foundation Model
Generates, reasons over and transforms information based on the instructions and context it receives.
07
Evaluation, Security & Operations
Testing, quality measurement, safety controls, monitoring, logging, cost management and deployment.
NELARA PRINCIPLE
The model is only one component. Reliable AI comes from designing the complete system around the model.
INTERACTIVE EXERCISE

Build the AI Stack

Put the components in the order that creates a reliable AI application. Think about what happens from the moment a user makes a request to the point where the system produces and validates an outcome.

Arrange the components into a reliable AI application.
Use ↑ and ↓ to rearrange the stack
01
User & Interface
Captures the user request through chat, UI or business workflow.
02
Application Logic
Controls orchestration, routing, permissions and workflow.
03
Instructions & Context
Defines the task and provides relevant information to the model.
04
Retrieval & Enterprise Data
Connects the application to documents, databases and knowledge sources.
05
Tools & Actions
Allows the AI application to search, calculate, call APIs and take actions.
AI
Foundation Model
Generates, reasons over and transforms information.
07
Evaluation, Security & Operations
Tests, protects, monitors and operates the AI system.
STACK COMPLETE
You have built a reliable AI application flow.
The key lesson: the foundation model is important, but reliable AI depends on the complete system surrounding it.
SCENARIO CHALLENGE

Build an internal HR AI assistant

Your company wants an AI assistant that can answer employee questions using approved HR policies and company documents.

0/6 placed
01 · APPLY THE STACK
Your challenge

Arrange the components in the order an employee request should move through the AI application. Think about what happens from the moment the employee asks a question until the system produces a reliable answer.

AVAILABLE COMPONENTS
YOUR AI APPLICATION
Drag to reorder
Start building
Click a component above to add it to your architecture.
NELARA PRINCIPLE
The model is only one component. Reliable AI comes from designing the complete system around the model.
The core concept

A language model can generate and reason over information, but the model alone does not create a production AI application. A reliable system combines the model with instructions, relevant context, enterprise data, tools, application logic, evaluation, security and operational controls.

Why the model is not the application

A foundation model is the intelligence engine, but an enterprise AI application needs much more around it. The application must decide what information the model receives, what actions it can take, what the user is allowed to access, how results are validated and what happens when the evidence is incomplete.

  • The model generates or transforms information.
  • The application controls the workflow around the model.
  • Context gives the model the information needed for the current task.
  • Retrieval connects the application to authoritative enterprise information.
  • Tools allow the application to interact with external systems.
  • Evaluation determines whether the result is good enough.
  • Security and governance control what the system is allowed to access and do.
How the layers work together

Consider an employee asking: “Can I work remotely from another country for three months?” A reliable assistant should not answer from general model knowledge alone. The application needs to identify the user, retrieve the relevant approved policies, provide that evidence to the model and return an answer that is grounded in the available information.

  • User request — captures the business question.
  • Identity and authorization — determines what the user is allowed to access.
  • Retrieval — finds the relevant approved enterprise information.
  • Context assembly — supplies the relevant evidence to the model.
  • Model — generates the response using the supplied context.
  • Validation and guardrails — check the response and apply policy controls.
  • Response and escalation — provide the answer or route the case for human review.
What can go wrong?

AI reliability depends on the complete system. A capable model can still produce a poor result when the application provides the wrong context, retrieves outdated information, exposes excessive permissions or fails to evaluate the response.

  • Wrong or incomplete context can produce an incorrect answer.
  • Outdated enterprise information can make a response unreliable.
  • Poor retrieval can surface irrelevant evidence.
  • Excessive permissions can expose information the user should not see.
  • Unvalidated tool calls can create unintended actions.
  • Weak evaluation makes failures difficult to detect.
  • Poor logging and monitoring make production problems difficult to investigate.
Enterprise design principle

Design the system around the business requirement, not around the model. Start with the user, the decision or task, the authoritative information and the required controls. Then determine where the model, retrieval, tools and application logic fit.

  • Start with the user and business outcome.
  • Identify the authoritative source of information.
  • Give the model only the context it needs.
  • Keep authorization outside the model.
  • Validate important outputs and actions.
  • Define what happens when evidence is missing.
  • Measure the system continuously after deployment.
1. The model

The model is the reasoning and generation engine of the application. Depending on the use case, it may generate text, summarize information, classify content, write code, reason over supplied context or work with multiple modalities. The important architectural principle is that the model is one component of the system, not the entire system.

2. Instructions and prompts

Instructions tell the model what the application wants it to do. A useful prompt normally separates the role, task, trusted context, constraints and expected output. Prompts shape behavior, but they should not be treated as a replacement for application-level authorization or security controls.

  • Role — what the assistant is expected to act as.
  • Task — the job it must perform.
  • Context — trusted information relevant to the task.
  • Constraints — what it must not do.
  • Output format — how the result should be structured.
3. Context engineering

Context is the information supplied to the model when it generates a response. It can include the user request, conversation history, system instructions, retrieved documents, tool results, application state and enterprise data. Good context is relevant and focused; more context is not automatically better.

  • Select only information relevant to the current task.
  • Separate trusted facts from the user request.
  • Keep instructions and retrieved information clearly distinguishable.
  • Avoid overwhelming the model with unnecessary information.
  • Design context deliberately rather than simply sending everything available.
4. Retrieval and RAG

Enterprise information usually lives outside the model — in documents, databases, knowledge bases, CRM systems, ERP systems and internal policies. Retrieval-Augmented Generation, or RAG, allows an application to find relevant information and provide it to the model as context before generating a response.

User question
    ↓
Search / retrieval
    ↓
Relevant enterprise information
    ↓
Context assembly
    ↓
AI model
    ↓
Grounded response
Why retrieval matters

The model should not be treated as the authoritative source for changing enterprise information. For example, an HR assistant answering a question about parental leave should retrieve the approved HR policy rather than relying only on the model’s general knowledge.

  • Policies can change.
  • Enterprise information may not exist in the model training data.
  • Different users may have different access permissions.
  • The application may need to show the source of an answer.
  • Retrieved information can be evaluated for relevance and freshness.
5. Tools and APIs

Some AI applications need to do more than generate text. Tools allow the application to connect the model workflow to external systems such as databases, CRM platforms, order systems, search services or business APIs.

  • Retrieval can provide information.
  • A tool can retrieve information or perform an operation.
  • Application code should enforce permissions before allowing sensitive actions.
  • Tool inputs and outputs should be validated.
User
  ↓
AI application
  ↓
Model decides a lookup is required
  ↓
Customer / Order API
  ↓
Validated result
  ↓
Model explains the result
6. Memory and application state

An AI application may need to remember selected information across interactions, but not everything should become memory. Conversation history, user preferences and workflow state are examples of information that may be useful to retain. Authoritative enterprise data should generally remain in the systems designed to manage that data.

  • Decide why information needs to be remembered.
  • Choose an appropriate storage location.
  • Apply access controls.
  • Define retention requirements.
  • Allow correction or deletion where appropriate.
7. Application and backend

Users normally interact with an application rather than directly with the model. The application and backend can handle authentication, authorization, session management, business rules, input validation, retrieval, model calls, tool execution, output validation and error handling.

User
  ↓
Application UI
  ↓
Authentication / Authorization
  ↓
Backend / Orchestrator
  ├── Retrieval
  ├── Memory
  ├── Tools / APIs
  └── Model
        ↓
     Response
8. Evaluation

A production AI application needs measurable quality criteria. Without evaluation, changing a prompt, model or retrieval strategy becomes guesswork. Start with a small representative test set and rerun it whenever the system changes.

  • Correctness — did the system provide the expected answer?
  • Groundedness — was the response supported by available information?
  • Relevance — did it answer the actual question?
  • Safety — did it avoid inappropriate or unsafe behavior?
  • Format validity — can the application reliably consume the result?
  • Latency — how quickly did the system respond?
  • Cost — what does each interaction consume?
9. Security and governance

AI applications introduce security considerations that must be designed into the architecture. Security should not be treated as a final feature added after the application works.

  • Protect credentials and secrets.
  • Enforce identity and authorization outside the model.
  • Validate tool access and tool parameters.
  • Protect sensitive enterprise information.
  • Consider prompt injection and malicious inputs.
  • Avoid exposing sensitive information through responses or logs.
  • Define human escalation paths for high-risk decisions.
  • Monitor and evaluate the system after deployment.
10. Logging and observability

Production systems need visibility into how they behave. Useful operational information can include request identifiers, model selection, latency, token usage, tool calls, errors and evaluation results. Logs should themselves be designed with privacy and security in mind.

  • Observe what the system is doing.
  • Evaluate whether the result is acceptable.
  • Identify failures and recurring patterns.
  • Improve the system using evidence rather than assumptions.
  • Avoid logging secrets or unnecessary sensitive information.
Enterprise example — HR policy assistant

Imagine an employee asks: “Can I work remotely from another country for three months?” A reliable enterprise assistant should not simply generate an answer from general model knowledge. It should use the employee identity, retrieve the relevant approved policies, assemble the appropriate context, generate a grounded response and provide an appropriate escalation path when the policy does not clearly answer the question.

Employee
    ↓
Enterprise AI Assistant
    ↓
Identity / Access Control
    ↓
AI Orchestrator
    ↓
HR Policy Retrieval
    ├── Remote Work Policy
    ├── International Work Policy
    └── Compliance Guidance
    ↓
Context Assembly
    ↓
AI Model
    ↓
Grounded Response
    ↓
Logging + Evaluation
The complete AI architecture
                         USER
                           │
                           ▼
                     APPLICATION UI
                           │
                           ▼
                 AUTH + BACKEND/API
                           │
              ┌────────────┴────────────┐
              │                         │
              ▼                         ▼
         RETRIEVAL                  TOOLS / APIs
       Enterprise Data             CRM / ERP / DB
              │                         │
              └────────────┬────────────┘
                           ▼
                   CONTEXT / ORCHESTRATOR
                           │
                           ▼
                         AI MODEL
                           │
                           ▼
                   VALIDATION / GUARDRAILS
                           │
                           ▼
                         RESPONSE

        Security + Identity + Evaluation + Monitoring
                     surround the system
Build exercise

Choose one practical AI assistant and create a one-page architecture sketch. The goal is not to choose the perfect technology. The goal is to understand what each component is responsible for.

  • Choose one use case: HR, customer support, sales, IT service desk or knowledge management.
  • Identify the user and interface.
  • Identify authentication and authorization.
  • Choose where authoritative information lives.
  • Identify whether retrieval is required.
  • Identify any tools or APIs the assistant needs.
  • Identify what information, if any, should become memory.
  • Identify how the response will be evaluated.
  • Identify security controls and monitoring.
Architecture questions
  • What does the model do?
  • Where does authoritative information come from?
  • What tools can the AI application call?
  • What information should be remembered?
  • How will you measure whether the answer is good?
  • What happens when evidence is missing?
  • What happens when the user is not authorized?
  • What happens when the model produces an incorrect answer?
Knowledge check
  • Why is an LLM only one component of an enterprise AI application?
  • What is the difference between context and retrieval?
  • When would an AI application need a tool or API?
  • Why should authorization not be delegated entirely to the model?
  • Why do production AI systems need evaluation?
  • Why is more context not always better?
  • Name three security or governance concerns for AI applications.
Definition of done

You can explain the major components of an AI application and describe how model, instructions, context, retrieval, tools, memory, application logic, evaluation and security work together. You have also created a one-page architecture sketch for a practical AI use case.

LEARNING CHECKPOINT

Capture the deliverable before moving on.

AI application architecture sketch is your evidence that this lesson has been applied, not just read.

✓ PRACTICAL OUTPUT