48 CZ-PRG (GMT+1)
US-NYC (GMT-5)
Blazor Web App (Server rendered)
AI AGENTS · THE BIG PICTURE

AI & Large Language Models

A practical guide to how LLMs work, how requests become responses, and how models are combined with tools, data, memory, and controlled workflows to build useful AI agents. It also compares providers, programming languages, Python frameworks, and vector databases.

An LLM generates

A language model predicts and generates tokens from its input. It can be useful without being a database, a search engine, or a source of guaranteed truth.

An agent acts

An agent combines a model with instructions, state, tools, and a bounded control loop. The surrounding application—not the model alone—controls what actions are allowed.

RAG retrieves

Retrieval-Augmented Generation finds relevant information at request time and supplies it to the model as context. Retrieval improves grounding, but does not guarantee a correct answer.

Production needs controls

Permissions, validation, evaluation, monitoring, privacy, and human approval are part of the system design—not optional extras added after an agent can use tools.

01 · FOUNDATIONS

What is AI, and what is an LLM?

Artificial intelligence (AI) is the broad field of building systems that perform tasks associated with human intelligence. A large language model (LLM) is one kind of AI model: it learns statistical patterns from large amounts of data and uses those patterns to understand and generate language. Modern foundation models may also work with images, audio, video, or structured data.

Term Meaning How it relates
Artificial intelligence The broad discipline of systems that perform tasks such as perception, reasoning, prediction, or generation. Umbrella term; not every AI system uses an LLM.
Machine learning Methods that learn patterns from examples instead of relying only on hand-written rules. A major family of techniques within AI.
Deep learning Machine learning based on multi-layer neural networks. The approach behind modern transformer language models.
Generative AI Models that generate new content, such as text, images, audio, or code. LLMs are generative models focused mainly on language, though many are multimodal.
Foundation model A broadly trained model that can be adapted to many downstream tasks. An LLM is often a language-focused foundation model; the terms are not interchangeable in every context.
Large language model A neural model trained to process and generate token sequences. It provides language capability; an application adds data, tools, workflow, memory, and user experience around it.
Useful mental model: an LLM is a powerful probabilistic component, not a complete application. Its answer depends on the model, prompt, context, tools, settings, and runtime around it.
Training versus inference: training adjusts model weights using data; inference is the request-time process of using the trained model to produce an output. Most agent applications use inference, not live model training.

Why transformers matter

Most current LLMs are based on transformer architectures. Attention mechanisms help a model relate parts of its input to one another, while training teaches it patterns in sequences. At inference time, the model generates output a token at a time (or in provider-specific chunks). This can produce fluent, useful results, but fluency is not proof that a claim is true.

02 · THE MODEL API

How a request, response, and tokens work

An application builds a request from the current user input plus instructions, relevant conversation history, retrieved documents, and any tool definitions. It sends that request to a model provider. The provider returns text, structured data, a tool-call proposal, a refusal, or an error. Exact API fields and message formats vary by provider and model.

1 · INPUT

Collect the task

The app receives a user message and checks identity, access rights, request size, and applicable policy.

2 · CONTEXT

Prepare model input

Instructions, conversation state, retrieved passages, and available tool schemas are assembled within context and token budgets.

3 · INFERENCE

Call the provider

The provider tokenizes the input, runs model inference, applies the requested generation settings, and returns output and usage information.

4 · DECISION

Read the result

The model may answer directly, return structured output, or request a tool call. A tool call is a proposal, not permission to execute it.

5 · ACTION

Validate and execute

If allowed, the application validates arguments and permissions, runs the selected tool, and sends its result back to the model when another reasoning step is needed.

6 · RESPONSE

Return and observe

The app returns a validated answer, optionally streams it as it is generated, and records useful metrics without unnecessarily retaining sensitive content.

Common message roles

Role Purpose Important detail
System / developer Set the assistant's role, boundaries, and application-level instructions. Names, precedence, and support differ between APIs. Do not treat a prompt as a substitute for authorization checks.
User Contains the current question or task and may include supported media. User-provided content is untrusted input, even when it appears inside a document or image.
Assistant Contains the model's answer, structured result, or tool-call request. Validate output against the application's expected schema and business rules.
Tool Contains the result returned by an application-executed function or external service. Tool results can also contain errors, sensitive data, or malicious instructions; treat them as data, not trusted policy.

What is a token?

A token is a piece of text or another model-specific input unit. It may be a whole word, part of a word, punctuation, or a non-text unit for supported media. A token is not the same as a word, and tokenization differs across models.

  • Input tokens include instructions, history, user content, retrieved passages, and tool results.
  • Output tokens are generated content; many providers price input and output separately.
  • Context window is the total input and output capacity for a model request. The maximum output may be lower than the full context window.
  • Token budget should leave room for the answer, tool results, and safety instructions; long history cannot grow without limit.

Generation settings

  • Temperature influences sampling variability; lower is often more consistent, not automatically more factual.
  • Top-p limits sampling to a probability mass. Avoid tuning it independently of temperature unless you have an evaluation reason.
  • Maximum output limits generated tokens and can truncate an answer.
  • Streaming sends partial output as it becomes available; it improves perceived latency, not answer quality.
  • Structured output constrains a response to a schema where supported; still validate business rules.
Tool-call loop: the model asks to call a named function with arguments; the application checks the name, schema, user permissions, and risk; the application executes it; then the result may be sent back to the model for a final response. Never expose a provider secret key in browser code or let a model run arbitrary functions without a policy layer.
03 · MODELS AND AGENT ARCHITECTURES

The main kinds of LLMs and AI-agent building blocks

People often use “LLM type” to mean two different things: a model capability (such as multimodal or embedding) or an application architecture (such as RAG or multi-agent). Keeping those layers separate makes design decisions easier. An agent is an application pattern around one or more models; it is not a special kind of language model.

Model capability families

Model family Typical work Design note
Instruct / chat Following instructions, answering questions, summarizing, and drafting. Use a model and prompt format designed for conversational or instruction-following tasks.
Reasoning-oriented Tasks that benefit from multi-step analysis, planning, or difficult problem solving. Can cost more or take longer; measure task accuracy instead of assuming a “reasoning” label guarantees correctness.
Code-focused Code explanation, generation, transformation, and software-development workflows. Generated code must still be reviewed, tested, and run in an appropriately isolated environment.
Multimodal Inputs or outputs involving text, images, audio, video, or combinations of these. Media support, accepted formats, token accounting, and safeguards vary by model.
Embedding Converting text or other supported content into vectors for similarity and retrieval. An embedding model is usually paired with an index or vector database; it does not generate an answer by itself.
Reranking Reordering a set of candidate passages by their relevance to a query. Often follows a fast search step to improve which evidence is placed in the LLM context.

Application and agent patterns

Pattern / component What it does When it helps
Chat assistant Accepts a message and returns an answer, optionally using conversation history. Question answering, drafting, support, and other conversational experiences.
Deterministic workflow Uses explicit application code for known steps, branches, and validations. Business processes that need predictable, auditable execution. Use this instead of an autonomous agent when the steps are already known.
Single agent Uses a model-driven loop to choose among bounded next steps and available tools. Tasks with variable paths where limited, iterative decisions add value.
Memory Stores and retrieves information across turns or sessions. Short-term memory is usually conversation state; long-term memory may live in a database or knowledge store. Personalization or continuity when the user has consented and the data is useful.
Privacy-preserving (“anonymous”) agent A design goal that minimizes identifying information, separates identity from task data, or uses pseudonyms. Privacy-sensitive workflows. “Anonymous agent” is not a standardized LLM architecture, and pseudonymization is not the same as guaranteed anonymity.
Multi-agent system Coordinates multiple model-driven roles, often with delegation, handoffs, or shared state. Work that benefits from genuinely distinct specialist tasks. Extra agents also add latency, cost, coordination errors, and more places to enforce policy.
RAG Retrieves relevant passages from an external knowledge source and adds them to the model's request. Private, domain-specific, or changing information that should not be baked into model weights.
Tools / function calling Lets a model request a typed function, API, search, or database operation through the application runtime. Actions or live data lookups. The app must validate arguments, scope credentials, and authorize each operation.
Skills Reusable procedures, instructions, or capability packages that teach an agent how to complete a task, sometimes with scripts or tools. Repeatable specialist tasks. “Skill” is a product- and framework-dependent concept, not one universal interchange format.
MCP (Model Context Protocol) An open protocol for connecting AI applications to external tools, data sources, and workflows through MCP clients and servers. Reusable integrations across compatible clients and servers. MCP is the standard acronym; “MPC” is a common transposition. A connection still needs authentication, authorization, and trust review.
Agent harness The runtime around an agent: turn loop, state, context management, tool execution, limits, retries, approvals, and observability. Long-running or production work that needs durable, inspectable execution. “Harness” is an evolving term, so compare the actual capabilities rather than the label.
Vector database Stores embedding vectors and metadata, then searches for semantically similar items. RAG and similarity search at a scale or with retrieval needs that justify a vector index.
Guardrails and human approval Applies input/output checks, policy decisions, permissions, and human review before sensitive actions. Any workflow that handles private data, external tools, consequential decisions, or irreversible actions.
Agent-to-agent (A2A) Protocols and patterns for agents or agent services to discover and delegate work to one another. Cross-system collaboration. It complements, rather than replaces, internal orchestration and security controls.
Do not add autonomy by default. A reliable application is often a deterministic workflow with one LLM call at a clearly defined step. Add an agent loop only when the model must make bounded decisions about what to do next.
04 · KNOWLEDGE RETRIEVAL

RAG, embeddings, and vector databases

RAG is a data pipeline plus a request-time retrieval step. It is not simply “put documents in a vector database.” Good results depend on document parsing, access control, chunking, search strategy, ranking, context construction, and answer evaluation.

1 · INGEST

Parse and prepare sources

Extract clean text and metadata from files, websites, or databases. Track source, version, tenant, permissions, and freshness.

2 · INDEX

Chunk and embed

Split content into useful passages, create embeddings, and index vectors with metadata. Chunk size and overlap should be evaluated on real questions.

3 · RETRIEVE

Search for evidence

Embed or otherwise process the query, apply tenant and access filters, and retrieve likely passages using vector, keyword, or hybrid search.

4 · RANK

Improve relevance

Optionally rerank candidates and remove duplicates or irrelevant passages before they use the model's context budget.

5 · GENERATE

Answer from supplied context

Give the model the question and selected evidence, request source-aware output, and instruct it to say when the retrieved material is insufficient.

6 · MAINTAIN

Keep it correct and current

Re-index changed or deleted sources, preserve access rules, monitor retrieval quality, and test that citations support the generated answer.

Vector-store choices you will commonly encounter

There is no universally “most-used” vector database for every team. The options below are common choices, not a market-share ranking. A vector index may be a dedicated service, an open-source database, or an extension to a database you already run.

Option Typical fit Trade-off to consider
Pinecone Managed vector search when a hosted service is preferred. Review service cost, deployment region, data handling, filters, and portability needs.
Qdrant Open-source and managed vector search with payload filtering. Choose between operating it yourself and using a managed deployment.
Weaviate Vector search with metadata and hybrid retrieval capabilities. Evaluate the operational model and features against your existing stack.
Milvus / Zilliz Large-scale vector search and managed Milvus-compatible deployments. Assess infrastructure and operations for the scale you actually need.
Chroma Developer-friendly local or hosted vector-store workflows. Confirm production, persistence, access-control, and scaling requirements for your deployment.
PostgreSQL + pgvector Teams already using Postgres that want vector search alongside relational data and SQL. Benchmark index type, filtering, query load, and operational needs before adding a separate database.
Start simple: small collections may work well with PostgreSQL, full-text search, or even a basic in-process index. A dedicated vector database is an architectural choice, not a prerequisite for every LLM project.
05 · MODELS AND PROVIDERS

Ways to use LLMs and the main providers

An application can call a provider directly, use a cloud platform that hosts models from several providers, or run an open-weight model on infrastructure you control. Frameworks sit above these choices: they can help with orchestration, but they do not remove provider-specific differences in features, limits, cost, or data handling.

Hosted model API

Use a provider SDK or HTTPS API. This is usually the fastest way to start; the provider operates the model infrastructure. Keep API keys on a trusted server, never in public browser code.

Cloud model platform

Use a managed platform such as Azure AI Foundry, Amazon Bedrock, or Google Vertex AI for model access integrated with a cloud's identity, networking, billing, and governance features.

Open-weight / local model

Run supported model weights on your own hardware or a hosting provider, using runtimes such as vLLM or Ollama. You gain deployment control but also own capacity, updates, security, and operations.

Provider and platform landscape

Provider / platform What to know Typical reason to evaluate it
OpenAI · GPT Hosted model APIs and agent-building tools with text, multimodal, structured-output, and tool-use capabilities that vary by model. General-purpose applications and teams using OpenAI APIs or the OpenAI Agents SDK.
Anthropic · Claude Hosted language models and tool-use interfaces; capabilities, context sizes, and terms vary by model. Evaluate for language, coding, analysis, and long-context use cases.
Google · Gemini Gemini APIs and Vertex AI deployments, with model-dependent multimodal capabilities. Teams building on Google Cloud or handling multimodal input.
Microsoft · Azure AI Enterprise cloud platform for accessing supported models and integrating identity, networking, and governance. Microsoft-oriented environments that need managed deployment controls.
Amazon · Bedrock A managed AWS platform offering access to supported model providers and related cloud services. AWS workloads that need centralized model access and cloud-native integration.
Meta · Llama Open-weight model families that can be hosted by third parties or run on suitable infrastructure; access and license terms depend on the release. Teams that need more deployment control and can operate or select a hosting service.
Mistral AI, Cohere, DeepSeek, xAI, and others Additional hosted and/or open-weight model options with different languages, modalities, deployment choices, and commercial terms. Benchmark against the actual task, region, quality, latency, privacy, and cost requirements.

Choosing a model or provider

  • Build a small, representative evaluation set and compare answer quality on your task—not on generic demos.
  • Check supported languages, modalities, structured output, tool calling, context limits, rate limits, and regional availability.
  • Measure end-to-end latency and total cost, including input/output tokens, embeddings, reranking, retries, and tool calls.
  • Review data retention, training use, residency, compliance terms, and access controls before sending sensitive content.
  • Plan for provider-specific behavior, API changes, outages, and rate limits. An “OpenAI-compatible” endpoint does not guarantee identical features or semantics.
06 · IMPLEMENTATION

Programming languages for building AI agents

An LLM is usually accessed over an API, so the model does not force your application into one programming language. Choose the language that fits the product, team, hosting environment, and library ecosystem. A direct HTTPS call is possible from almost any language; server-side secrets and policy enforcement remain essential.

Language Strengths Common fit
Python Broad AI, data, evaluation, and agent-framework ecosystem. Prototypes, data workflows, model services, and most Python-first agent frameworks.
TypeScript / JavaScript Strong web and server ecosystem, useful streaming support, and shared types across front and back ends. Web applications, Node.js backends, and browser-based user experiences. Keep privileged provider calls on the server.
C# / .NET Strong typing, mature enterprise tooling, dependency injection, and integration with existing .NET services. Business applications, ASP.NET services, and teams already building on Microsoft technologies.
Java / Kotlin Mature JVM libraries and established enterprise deployment patterns. Large services, Android applications, and JVM-based organizations.
Go / Rust Useful for efficient services, infrastructure, and lower-level systems work. High-throughput APIs, gateways, and model-serving infrastructure; verify the framework and provider SDK coverage you need.
Building in .NET? Continue with AI LLM & .NET for Blazor client/server patterns, provider SDKs, .NET agent frameworks, and RAG with vector stores.
07 · PYTHON ECOSYSTEM

Python frameworks for creating AI agents

The order below preserves the five-framework ranking you supplied. Treat it as a practical shortlist, not a universal measurement of downloads or production usage: popularity changes by community and use case, and there is no single authoritative ranking that applies to every team. The right framework is the one whose control model, provider support, operational features, and maintenance fit your application.

Rank Framework Best fit and strengths Trade-offs
1 LangGraph Stateful, multi-step workflows and production agents that need explicit control flow. It models work as a graph of nodes and transitions, and supports persistence, streaming, and human-in-the-loop patterns. Deterministic application steps can be combined with model-driven decisions. It is a lower-level orchestration layer; the flexibility brings more concepts and implementation responsibility than a simple agent abstraction.
2 CrewAI Role-based agent teams and fast prototypes. Crews describe collaborative agents and tasks; Flows provide structured state and control around them. Agent delegation can be difficult to debug if the flow is vague. Keep roles, responsibilities, tool permissions, and stop conditions explicit.
3 OpenAI Agents SDK A lightweight Python runtime for agents, function tools, handoffs, guardrails, sessions, human approval, and tracing. It suits teams that value a small set of explicit primitives and OpenAI-first integration. Review model/provider compatibility and feature support for the exact deployment; do not assume every provider exposes identical behavior through a compatible API.
4 Pydantic AI Python applications that favor typed inputs, dependencies, tool arguments, and validated structured results. It fits naturally into conventional service code and supports multiple model providers. Its typed approach helps catch shape errors, but it does not replace domain validation, authorization, evaluation, or operational controls.
5 AutoGen (Microsoft) Event-driven multi-agent conversation, group collaboration, and distributed agent experiments. It is useful when the problem genuinely needs agents to coordinate rather than one model call. Multi-agent interactions can add setup, cost, latency, and less predictable behavior. For new Microsoft-centric projects in 2026, also evaluate the newer Microsoft Agent Framework, which documents agents, harnesses, workflows, and integrations across .NET, Python, and Go.

Other useful frameworks and adjacent tools

Project Why it may be useful
LangChain Higher-level model, prompt, and tool integrations in the LangChain ecosystem; LangGraph is the more explicit graph-orchestration layer.
LlamaIndex Data connectors, indexing, retrieval, and workflows for applications centered on private knowledge and RAG.
Haystack Composable pipelines for search, retrieval, and question-answering systems.
Microsoft Agent Framework / Semantic Kernel Microsoft-oriented agent and workflow tooling. Compare current support, language coverage, and migration guidance for your target runtime.
DSPy A programming model for composing and optimizing LLM pipelines against examples and measurable objectives.
Framework selection rule: start with a direct provider SDK or a small deterministic workflow. Add an agent framework when you need its concrete value—such as durable state, graph control, handoffs, typed tools, or tracing—not just because the project uses an LLM.
Looking for Python code? Continue with the AI LLM & Python guide for examples covering these frameworks, chat, agents, RAG, vector stores, tools, MCP, and production practices.
08 · FROM DEMO TO PRODUCTION

Building reliable, safe, and maintainable agents

A successful demo proves that a model can produce an interesting output. A production system must also be dependable, observable, permission-aware, cost-controlled, and recoverable when the model or a dependency fails.

Security and privacy

  • Treat user messages, retrieved documents, webpages, and tool results as untrusted. Prompt injection can arrive indirectly through any of them.
  • Give each tool least-privilege credentials and narrow, server-side authorization. A prompt instruction is not an access-control boundary.
  • Validate tool arguments and outputs; require human confirmation for payments, deletion, external messages, or other consequential actions.
  • Keep API keys and sensitive system prompts out of browser bundles, logs, and model-visible content unless needed.
  • Enforce tenant filters before retrieval, redact sensitive telemetry, and define retention and deletion policies for conversation memory.
  • Run generated code only in an isolated environment with explicit resource and network limits.

Evaluation and observability

  • Create representative test cases before tuning prompts or switching models; include difficult and adversarial inputs.
  • Measure task success, factual grounding, citation quality, tool selection, schema validity, refusal behavior, latency, and cost.
  • Trace model calls, retrieval, tool calls, retries, and approvals so failures can be diagnosed end to end.
  • Redact secrets and personal data from traces; retain only what the team needs and is permitted to store.
  • Version prompts, model identifiers, tool schemas, retrieval settings, and evaluation sets so changes can be compared.
  • Set bounded timeouts, retries, rate limits, token budgets, and safe fallbacks; surface provider errors instead of fabricating success.

A pragmatic implementation sequence

  1. Define one measurable task. Decide what a successful answer or action looks like and which failures are unacceptable.
  2. Start with the simplest baseline. Try a direct model call or deterministic workflow before introducing memory, RAG, or multiple agents.
  3. Add only the needed context. Use retrieval for changing or private facts; use curated instructions for stable behavior; consider fine-tuning only when examples show it is appropriate.
  4. Expose narrow tools. Give each function a typed schema, minimal permissions, timeouts, and clear error handling.
  5. Bound the loop. Cap model turns, tool calls, elapsed time, token use, and spending; define how the workflow stops or asks a person for help.
  6. Test with real cases. Evaluate outputs, retrieval, tool execution, security boundaries, and failure recovery before deployment.
  7. Deploy gradually. Monitor quality, cost, latency, and incidents; use human review and a rollback path for changes to prompts, models, or tools.
09 · QUICK REFERENCE

Glossary

Term Short definition
API An interface through which one application requests data or functionality from another service.
A2A Agent-to-agent protocols or patterns for communicating and delegating work across agents.
Embedding A numeric vector representing content in a space where related items can be compared by similarity.
Fine-tuning Further training a model on curated examples to adapt behavior or task performance; it is not a substitute for live retrieval of frequently changing facts.
Hallucination A plausible-sounding generated claim that is unsupported or incorrect.
MCP Model Context Protocol, a standard for connecting AI applications with compatible tools, data sources, and workflows.
Prompt injection Instructions in user or external content that try to override an application's intended behavior or cause unsafe actions.
RAG Retrieval-Augmented Generation: retrieve relevant evidence, then provide it as context to a generative model.
Reranker A model or component that reorders candidate search results by relevance to a query.
Vector database A database or index that stores vectors and supports similarity search, often with metadata filters.
FURTHER READING

Official documentation

Model catalogs, APIs, framework capabilities, and pricing change frequently. Use current official documentation when selecting a stack or implementing an integration.

An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.