⚡ Technical — build with AI
For people who code or want to code: APIs, architecture, RAG, customization, agents, vision, text, production, and governance.
Track Map
🔌 Development with AI APIs
The first correct API call
🏗️ Architecture of AI Applications
The model is just one piece
📚 RAG and Knowledge Bases
Answer with your documents
🎛️ Fine-Tuning and Customization
When to train and when not to
🕸️ Agents and Complex Workflows
Loops, tools, and control
👁️ Advanced Computer Vision
Machines that see
📝 NLP and Text Processing
Text becomes data
🛠️ MLOps and Production
From notebook to reliable service
⚖️ AI Ethics and Governance
Trust is designed
Detailed content
🔌 Development with AI APIs
Call models through APIs and locally: messages, parameters, streaming, structured output, costs, and errors.
What it is Calling a model through an API means sending an HTTP request with a list of messages and receiving the generated continuation. An SDK (software development kit, such as Python's openai package) builds that request for you and handles authentication, timeouts, and…
People who only use chat depend on the interface someone designed. People who call the API can put the model inside their own system: in a form, a spreadsheet, a customer service bot, or a script that runs overnight. Learning to use a local model removes both barriers…
Endpoint address that receives the request SDK library that builds the API call base_url local or cloud, same code usage tokens spent on the call
What it is This is the conversation format in the API: an ordered list of messages with roles ( system, user, assistant, tool) that your code builds and resends in full with every call.
Almost every strange chatbot bug — "it forgot what I said," "it changed its tone," "the bill was high" — comes from how the message list was built. Understanding the roles and the fact that the API has no state solves most of these problems before…
system general conversation rules user / assistant question and answer Stateless the server does not remember History resent with every call
What it is Parameters are the controls that adjust how the model generates: degree of variation ( temperature, top_p), maximum length ( max_tokens), stopping points ( stop), and repeatability ( seed).
The same model can seem "dumb" or "smart" depending on the parameters. High temperature in a data extraction task leads it to invent fields; a zero-temperature idea generator repeats the same idea. Adjusting three controls costs nothing and solves problems that seem to come from…
temperature how much the model varies max_tokens length and cost limit finish_reason why generation stopped Reasoning models have their own controls
What it is Streaming means receiving the response in chunks, token by token, as it is generated. Just pass stream=True and iterate over the chunks in a for loop.
In any interface where someone is waiting for a response — chat, an assistant inside a system, customer service — streaming is what separates "it seems stuck" from "it's responding." For background tasks (processing a thousand documents), it doesn't help and only…
stream=True response in chunks Chunk / delta each received chunk TTFT time to first token SSE text events over HTTP
What it is: Structured output means having the model respond in a format that code can validate (JSON with a schema). Tool calling means letting the model request that your functions be run, returning the function name and arguments in JSON; you run the function and return the result as a message…
This is where the model stops being a text generator and becomes a piece of software: it reads an email and fills out a form, classifies a support request and opens the right ticket, or decides which system function to call. Without validation, this piece can fail silently; with it…
Schema expected fields and types JSON mode response_format in the API Tool calling the model makes a request, you run it MCP standard for offering tools
What it is: It’s the economics of the API: costs grow with input and output tokens, and usage is limited by requests and tokens per minute. To optimize, send less, generate less, reuse more, and choose the smallest model that gets the job done.
A prototype that costs pennies can get expensive when a thousand people use it, because each person resends the conversation history and each response generates tokens. If you understand the formula, you can design the system to be inexpensive from the start instead of finding out from the bill.
Input × output different prices Rate limit requests and tokens per minute 429 you exceeded the limit; wait Prompt caching repeated beginnings cost less
What it is: It’s the integration’s reliability and protection layer: set a timeout for every call, retry only transient errors, keep the key out of your code, avoid personal data unless needed, and treat all text from outside as untrusted.
A key leaked on GitHub can be used by others on your account very quickly. An integration without a timeout can stall the entire system when the provider slows down. These two safeguards, along with treating external text as untrusted, are the minimum for any…
Transient × permanent only the first warrants a retry Backoff with jitter increasing, randomized waits Keep secrets out of code use an environment variable Prompt injection external text is data
🏗️ Architecture of AI Applications
Layers of an AI application: orchestration, state, cache, queues, observability, and graceful degradation.
What it is: AI application architecture organizes a system into layers—interface, backend, orchestration, model gateway, and models—with two cross-cutting services: state (data and memory) and observability (logs, metrics, costs).
Models change quickly: today’s best is replaced within months, and prices go up and down. If you couple a product to a specific model, you have to rewrite the system each time you switch. If you separate the layers, you can replace one piece and move on—and answer questions…
Layer one clear responsibility Coupling dependence on others’ details Orchestration where AI logic lives Cross-cutting state and observability
What it is: Orchestration is the layer that connects the steps around the model—preprocessing, the call, validation, and post-processing—with quality gates between them. It can be a fixed pipeline or an agent that chooses the next step.
Most of an AI product’s quality comes from what happens before and after the call, not from the model. A pipeline with quality gates turns “sometimes the model responds incorrectly” into “when the model makes a mistake, the system notices and reacts”—which is what a customer…
Pipeline fixed steps in sequence Agent the model chooses the step Quality gate validation between steps LangGraph steps laid out as a graph
What it is: A single point of access to models that routes each task to the right model, tries alternatives in order when one fails, measures time and tokens, and hides which provider is being used from the rest of the system.
With a gateway, testing a new model means changing one line in the routing table, comparing results, and switching back if you don’t like them. Provider outages become a line in the log instead of an incident. And you can answer “How much does each feature cost?” because every…
Gateway single point for calls Route by task ask for what you need, not who Fallback ordered list of alternatives Cascade cheapest first, more expensive if needed
What it is: Managing state means deciding where the conversation is stored (database), which parts are sent back to the model (recent window + summary + long-term facts), and how long each part is kept.
An assistant that forgets what the customer said three messages ago is frustrating; one that resends the entire conversation with every question gets expensive and slow. Deliberately managing memory is what makes a chatbot seem attentive without the bill growing along with the…
Short-term recent messages Long-term facts that carry across sessions Sliding window last N messages Summary the old content in a few lines
What it is Cache is a memory of previously calculated answers, checked before calling the model. The key identifies the request (exactly or by similarity), and the TTL determines how long the answer remains valid.
Many systems receive the same questions all the time: business hours, return policy, service status. Answering from the cache is faster for the user and doesn’t use tokens. Knowing where caching helps—and where it serves an outdated answer or one from another…
HIT / MISS found or not found in the cache TTL how long the answer remains valid Semantic cache same intent, different words Invalidation delete when the source changes
What it is Asynchronous processing separates “receiving the request” from “doing the work”: a queue holds the jobs, and independent workers run them at a pace the model and budget can handle.
The queue is what lets you process documents in batches, run a local model overnight, and absorb spikes without taking down the system. It also lets you use providers’ batch APIs, which cost less because the result doesn’t need to be ready right away.
Queue jobs waiting their turn Worker process that runs a job Idempotency repeat without duplicating the effect DLQ where repeated failures end up
What it is Observability means recording what the system did and how much it cost for each call and request. Graceful degradation means having progressively simpler—and honest—response options for when parts of the system fail.
Models fail silently: the answer comes out well-written but wrong, with no exception in the log. Without observability, you only find out from the customer. And without degradation steps, an external provider going down can take your entire product down.
Trace the path of a request Circuit breaker stops calling a service that’s down Step simpler, honest response Eval repeatable quality test
📚 RAG and Knowledge Bases
Embeddings, chunking, vector and hybrid search, reranking, source citations, and RAG evaluation.
What it is RAG is an architecture pattern with two phases: indexing (splitting documents into chunks, calculating embeddings, and storing them in an index) and querying (retrieving the chunks most relevant to the question and asking the model for an answer based only on those chunks, with…
It’s the most requested AI use case in companies: a support assistant that reads the knowledge base, searches internal policies, or answers questions about contracts. Understanding both phases lets you diagnose the right problem when an answer fails—and most…
Retrieval find the right chunks Generation answer using only those chunks Indexing prepare the documents Knowledge base documents ready for search
What it is An embedding represents text as a vector in a space where distance indicates differences in meaning. It lets you search “by meaning” instead of “by the exact word.”
Users never phrase a question with the same words used in the document. Embeddings connect “I was charged twice” to a paragraph about “duplicate billing.” Without understanding this link, it’s impossible to adjust the search when it gets things wrong.
Vector list of numbers Cosine how similar the meanings are Normalize length of 1, quick calculation Same model for the document and the question
What it is Chunking is the strategy for splitting documents into indexable chunks: their size, where to split, overlap, and metadata for each chunk.
Search only finds what was split well. A chunk that mixes shipping and warranty won’t show up for either question; a rule split in half reaches the model incomplete. Chunking is the cheapest step to adjust and the one that most changes the…
Chunk indexable passage Overlap don’t split an idea in half Metadata source, section, date, access Parent and child fine-grained search, broad context
What it is Vector search finds the k vectors closest to the question’s vector. A vector database stores vectors with metadata, indexes them for fast search, and applies filters.
Choosing a search tool based on the actual size of the problem saves weeks of infrastructure work. And metadata filtering is what keeps an internal assistant from showing the executive team’s contract to someone who shouldn’t see it—a real risk in any RAG…
top-k how many chunks are returned Exact × ANN full accuracy or speed Vector database vectors + text + metadata Filter who can see what
What it is Hybrid search combines keyword search (BM25) and meaning-based search (vector) in one list, generally using RRF. Reranking is a second step that reorders the best candidates with a model that reads the question and passage together.
Real-world databases are full of codes, acronyms, and names that meaning-based search misses. Hybrid search and reranking are the two search improvements with the best effort-to-results ratio after good chunking—and knowing the order to apply them helps you avoid complicating the system…
BM25 searches for exact words Hybrid: words + meaning RRF merges lists by position Reranker: a more precise second pass
What it is: An end-to-end RAG in Python: it indexes a folder of .md / .txt files, searches for the four passages closest to the question, and generates an answer that cites each source—all locally and for free with Ollama.
Frameworks like LlamaIndex and LangChain do all this in a few lines—and hide where the problem lies when an answer comes out wrong. Building it by hand once makes clear what each piece does; then you can use the framework knowing what to swap out, or discover that you don’t…
Task prefix: document × question Citation [file#passage] for every fact “I couldn’t find it”: an honest answer is allowed Reindex when the document changes
What it is: Evaluating RAG means running a fixed set of questions and measuring, separately, whether search found the right source (hit@k, MRR) and whether the answer was faithful to the sources and relevant to the question.
Without evaluation, every RAG adjustment is a guess, and improvements on one question can hide regressions on others. With a gold set and two search metrics, you can use data to decide whether it’s worth switching models, changing passage size, or adding a reranker—and…
Gold set: questions + expected source hit@k: did the source appear among the top k? MRR: at what position did it appear? Faithfulness: is the answer supported by the sources?
🎛️ Fine-Tuning and Customization
Prompt, RAG, or fine-tuning: the decision ladder, LoRA, data preparation, evaluation, and costs.
What it is: The decision ladder is the order in which you try to customize a model: a well-written prompt, then examples in the prompt (few-shot), then RAG, and only then fine-tuning. Each step costs more to build and maintain than the one before it.
Training without a need creates a model you have to version, host, and retrain every time you switch the base model. Knowing when to step down the ladder saves weeks—and knowing when to step up delivers what no prompt can.
Few-shot: examples inside the prompt RAG: knowledge retrieved at the time of the request Fine-tuning: behavior encoded in the weights Diagnosis: what the model is missing
What it is: Fine-tuning means continuing to train a pretrained model with your own examples. The model doesn’t “memorize a document”; it adjusts weights to reproduce the behavior patterns in the examples—format, tone, and decisions.
Knowing what training changes helps avoid the most common false expectation: “I’ll train it on the company’s PDFs and it’ll know everything.” Fine-tuning encodes behavior; facts that need to be accurate and up to date still belong in RAG.
Loss: the error training reduces SFT: pairs with ideal answers DPO: better × worse answer Forgetting: gain here, lose there
What it is: LoRA is a parameter-efficient fine-tuning (PEFT) technique that keeps the original model intact and trains a small, low-rank adapter. QLoRA is the same approach with the base model quantized to 4 bits so it fits in less memory.
LoRA is what made fine-tuning accessible outside major labs: small models can be trained on a consumer GPU or in Colab, and you can version adapters the way you version code. In 2026, it’s the standard approach for customizing open models.
Adapter: small file that plugs in Rank (r): width of the trainable deviation Quantization: weights represented with fewer bits PEFT: train a little, gain a lot
What it is: Preparing data means collecting, cleaning, standardizing, and splitting examples of inputs and ideal outputs into a format the trainer understands (JSONL of messages), with a separate portion for validation and testing.
Dataset quality determines the result more than any hyperparameter. People who master data preparation run fewer blind training jobs and get a better model with fewer examples—and without leaking personal data into the weights.
JSONL: one example per line Validation: data the training process doesn’t see Deduplication: prevent memorization Anonymization: LGPD (Brazil’s data protection law) before training
What it is: A local LoRA training run: load the base model, attach the adapter with LoraConfig, pass the train.jsonl and val.jsonl files to SFTTrainer, and save the adapter to a folder.
Running a small training job end to end takes fine-tuning out of the realm of theory. You learn to read loss curves, recognize overfitting (when the model memorizes the training examples), and use data to decide whether it’s worth scaling up to a larger model.
Hyperparameter a setting you choose Learning rate step size Overfitting memorized, didn’t learn Checkpoint snapshot of the model at a point in time
What it is Evaluation means running the base model and the fine-tuned model on the same test set, using the same criteria, and comparing their accuracy rate — including some general cases to detect forgetting.
Without evaluation, fine-tuning is a gamble. With evaluation, each run becomes a number you can compare, defend in a meeting, and reproduce when the base model changes. It’s the same habit that separates a prototype from a production system.
Eval fixed test with criteria Test set never seen during training Rubric criteria for open-ended text Baseline what to beat
What it is The lifecycle of the fine-tuned model: total cost (data, training, inference, retraining), how to serve it (merged or adapter), versioning alongside the dataset and evaluation, and the base model’s license.
Fine-tuning that works in a notebook and dies in production is the most common outcome. Thinking about the lifecycle from the start — how to serve it, how much it costs per month, how to retrain it — is what turns the experiment into an asset the team can maintain.
Inference cost of each response Merge LoRA merged into the weights GGUF format for running locally License what the base model allows
🕸️ Agents and Complex Workflows
The agent loop, tool calling, MCP, multi-agent orchestration, verification, and safety limits.
What it is An agent is a language model in a loop controlled by your code: at each turn, the model chooses a tool or gives the final answer; the code runs the tool, appends the result to the conversation, and calls the model again.
Every agent framework — LangGraph, CrewAI, OpenAI Agents SDK, Claude Agent SDK — is a variation on this loop. Understanding the loop itself lets you choose a framework based on what it actually adds, and debug when the agent “gets stuck” or “goes in circles.”
Agent model in a loop with tools Tool function the model can request Observation result returned to the model ReAct reason and act in turns
What it is Tool calling is the message protocol in which the model requests that a function described by JSON Schema be run, and your program returns the result in a message with the tool role. It’s the same format in OpenAI, Ollama (route /v1), and, with different names…
When an agent makes a mistake, it’s almost always in one of these messages: a vague tool description, a poorly validated argument, or a result that’s too long returned to the model. Knowing how to read the message exchange is the most important skill for debugging agents.
JSON Schema describes the parameters tool_calls the model’s request tool_call_id links the request and result Description what guides the choice
What it is A minimal, complete agent: tool definitions in JSON Schema, corresponding Python functions, a loop with a step limit, and a log of every call in the terminal.
Writing the loop by hand once takes the magic out of frameworks. You’ll know exactly where to add validation, approval, logging, and cost limits — and you can build simple agents without any dependencies beyond an HTTP client.
Step limit prevents an infinite loop Folder lock limits access to what’s needed Error as text so the model can try again /v1 compatible same code, different provider
What it is MCP is an open standard for connecting AI applications to tools and data. You write the tool once as an MCP server, and any compatible host can list and call it without a custom integration.
MCP has become the common way to give assistants and agents a way to interact with the world. Knowing how to write a server lets you expose your company’s systems to any compatible host — and understanding how it works helps you assess the risk of installing third-party servers.
Host the app where the AI runs MCP server exposes tools and data stdio × HTTP local or remote Resources read-only data
What it is These are composition patterns: chain steps, route by request type, run in parallel, orchestrate subagents, and have one model evaluate and ask another to make corrections. Choose the pattern based on the task, not the trend.
Choosing the right pattern is the architecture decision with the biggest impact on cost and reliability. A well-built simple routing system often beats a sophisticated multi-agent system that no one can debug.
Workflow path in the code Orchestrator splits up work and delegates Subagent clean, focused context Routing each request follows the right flow
What is Verification means proving the result against an executable criterion; observability means recording each agent step to debug, measure cost, and compare versions. Together, they turn “it seems to work” into evidence.
It’s the difference between a demo and a system you trust to run on its own overnight. Without a trace, you don’t know why it failed; without a completion criterion, you don’t even know whether it failed.
Completion criterion: command + expected output Trace: record of each step Limit: steps, tokens, time, cost Agent eval: fixed tasks for each version
What it is These are barriers outside the model that limit possible damage: minimum permissions, a sandbox, an allowlist of actions, human approval for irreversible actions, cost limits, and a record of everything—because the prompt alone can’t stop an injection.
An agent with broad access is a credential that can read the internet. Designing limits before turning on the agent costs less than explaining a leak afterward—and it’s what lets you grant more autonomy safely.
Prompt injection: hidden instruction in the data Lethal triad: private + untrusted data + output Least privilege: only what’s necessary Human approval before irreversible actions
👁️ Advanced Computer Vision
Classification, detection, segmentation, OCR, and vision-language models applied to real problems.
What it is It’s a classification of vision tasks by output type: label (classification), boxes (detection), masks (segmentation), text (OCR), and a free-form answer or JSON (VLM). Each has its own models, annotation formats, and metrics.
Vision projects often fail because they choose the wrong task: segmenting when boxes would do, or using a slow VLM when a small detector can run in real time. The map helps you size the data, hardware, and timeline before writing code.
Pixel: three color values Detection: class + box Mask: pixel by pixel VLM: image + language
What it is Object detection locates each object with a box (coordinates x1, y1, x2, y2), a class, and a confidence score. YOLO does this in real time on a GPU and at an acceptable speed on a CPU with its smaller versions.
Detection is the vision task with the most direct applications: counting, inventory, workplace safety, and quality control. Understanding confidence, IoU, and NMS lets you adapt a ready-made detector to your situation without training anything.
Confidence: score from 0 to 1 IoU: box overlap NMS: removes duplicates COCO: 80 reference classes
What it is Segmentation classifies every pixel in an image. The output is a mask (an image of the same size where each pixel indicates which object or class it belongs to), useful when an object’s shape and area matter.
Segmentation enables measurements that detection can’t provide—area, outline, and clean cropping—and promptable models have greatly reduced the work of annotating data. Knowing when to use it helps you avoid paying the cost of a mask when you don’t need one.
Semantic: color by class Instance: mask per object SAM: segments with a click Panoptic: objects + background
What it is OCR converts an image of text into text. Document extraction goes further: it identifies fields (date, CNPJ, total amount) and structure (tables, sections), combining OCR, layout analysis, and increasingly, VLMs.
Much of the information companies use still lives in scanned PDFs, photos, and paper documents. Automating reading with validation is one of the vision projects with the quickest payoff—and one that requires the most care to catch silent errors.
OCR: image becomes text Layout: the page structure Field extraction: amount, date, CNPJ Rule-based validation: checks what it read
What it is A vision-language model takes an image and text as input and generates text. It can describe images, answer questions, compare images, and extract information in a structured format, without training a model for each task.
VLMs have replaced weeks of training with a prompt for many low-volume tasks: classifying inspection photos, reading varied documents, and describing images for accessibility. Knowing how to request JSON and validate the output is what makes this reliable in a system.
Encoder: image becomes vectors Patch: piece of the image Base64: image as text JSON output: answer becomes data
What it is It’s the customization cycle for vision: collect and annotate images from your situation, fine-tune a pretrained model, and measure precision, recall, and mAP on a validation set that represents real-world use.
A ready-made model handles the general case; the project’s value comes from the classes and conditions in your situation. Knowing how to annotate, fine-tune, and interpret precision and recall lets you promise a result—and know when it still isn’t good enough.
Transfer learning starts from pretrained weights Precision correct detections among alerts Recall actual items found mAP class summary and IoU
What it is The set of choices for running computer vision in the real world: where to run it, how to track objects in video, how to detect and correct drift, and how to handle images of people under LGPD (Brazil's data protection law) and with respect for those being filmed.
Most computer vision systems don’t fail because of the model; they fail because of latency, unmonitored drift, or a legal issue discovered too late. Designing the full cycle and privacy protections from the start is what helps a project survive its first year.
Edge runs near the camera Tracking same identity across frames Drift the world changes, the model doesn’t Sensitive data biometrics under LGPD
📝 NLP and Text Processing
Tokenization, classification, entity extraction, summarization, semantic search, and text pipelines with LLMs.
What it is The path text → tokens → numerical IDs → vectors. The vectors (embeddings) carry the meaning the model learned; everything that comes next—classification, extraction, search—operates on them.
Understanding tokens explains the bill that arrives at the end of the month, why a document “doesn’t fit” in the context window, and why poorly cleaned text confuses the model. It’s the foundation for sizing any text pipeline before writing the first line of code.
Token a piece of the vocabulary Subword (BPE) a rare word becomes parts Normalization standardize without losing meaning Embedding meaning as a vector
What it is A function that receives text and returns a label from a list you define, preferably with a short explanation and in a format the rest of the system can validate.
Almost every customer service, triage, or sentiment analysis system starts with classification. Knowing how to choose between the traditional approach, fine-tuning, and an LLM—and how to validate the output—helps you avoid both an overly expensive project and one that breaks on its first unexpected response…
Fixed list labels you define Zero-shot no training examples JSON output the system can read Validation a label outside the list becomes “other”
What it is Information extraction: locating passages with specific meaning in free-form text and returning them organized by type, ready to go into a database or another pipeline step.
Much of the value of NLP in companies comes from extracting data from documents: receipts, contracts, medical reports, résumés, and emails. Knowing how to extract data using a schema and verify it against the original text is what separates a demo from a process you can trust.
NER names with types JSON Schema the required format Grounding the passage exists in the text spaCy ready-to-use NER, on CPU
What it is Step-by-step summarization: the document is split into sections, each section gets a partial summary with a reference to its source, and finally a summary combines the partial summaries in the format the reader needs.
Reports, meeting minutes, case files, and manuals are long and read in a hurry. A traceable summary saves hours of reading without hiding where each conclusion came from—and the same split, process, and combine pattern works for translation, extraction, and review…
Extractive copies sentences from the original Abstractive rewrites in different words Chunking sections based on structure Map-reduce summarize sections, then combine
What it is Search by similarity in meaning: an embedding model converts texts into vectors, and the query returns the texts closest to the question by cosine similarity, even when they have no words in common.
Semantic search is the foundation of assistants that answer using company documents, ticket deduplication, and content recommendations. Understanding the vector and the metric helps you diagnose why a search fails—before blaming the LLM for a bad answer.
Embedding text as a vector Cosine similarity in meaning Vector database pgvector, Qdrant, Chroma Hybrid search keyword + vector
What it is Treating language and local formats as part of the problem: detect the language, choose suitable models and prompts, standardize Brazilian numbers, dates, and documents, and test with real texts from your audience.
Examples, tutorials, and benchmarks are often in English. Anyone building for a Brazilian audience needs to know the typical failure points in Portuguese and local formats—that’s where a system that “worked in testing” breaks with its first real customer.
Language detection first step of the pipeline Multilingual languages in the same space Local format dates, currency, CPF Glossary terms always the same
What it is A sequence of text-processing steps with input and output contracts, accompanied by a labeled test set that measures every change before it reaches users.
Without a test set, every prompt adjustment is a guess and every model switch is a risk. With one, you can switch to a cheaper model knowing how much quality you lose, prove the improvement to your team, and catch errors before they reach customers.
Test set examples with correct answers Baseline the number to beat Precision × recall correct predictions by label Error analysis read what failed
🛠️ MLOps and Production
Versioning, continuous evaluation, deployment, monitoring, cost, and incidents in AI systems.
What it is A continuous cycle: version what defines behavior, evaluate before release, roll out gradually, observe in production, respond to incidents, and turn every lesson into a new version.
Building a prototype with an LLM is easy; keeping a reliable service running is still hard. If you master the full cycle, you can put AI to real use, defend the project with numbers, and sleep soundly after deployment.
MLOps / LLMOps Treat AI as software Production users depend on it Inference using the model Continuous cycle errors become tests
What it is Give each production version an identifier that points to the code commit, prompt version, exact model, evaluation data version, and configuration used—so you can reproduce any response.
Without complete versioning, you can't investigate an incident, compare two versions, or fulfill an audit request (“Which system made this decision in March?”). It's cheap to do at the start and very expensive to reconstruct later.
A prompt is code file, review, version Pin the model never “latest” Release one name for all five pieces Reproducible recreate the same response
What it is Automatically run the test set with every change and treat any drop in quality as a failing test: the version doesn't go to production until someone explains or fixes it.
Prompts and models change all the time, and an improvement in one case often makes another worse. The automated gate turns “I think it's better” into a comparable number and keeps silent regressions from reaching users.
Quality gate blocks regressions Baseline today's number CI test every commit LLM as judge score with a rubric
What it is Wrap the model in a service with a clear contract (input, output, errors), time and size limits, a fallback response, and a gradual rollout with a quick way back.
Models slow down, go offline, and return unexpected formats. A service with a timeout, fallback, and gradual rollout turns these failures into controlled degradation instead of an error screen for the customer.
Timeout limit per call Fallback backup response Canary traffic in stages Real time × batch urgency determines cost
What it is Continuously track whether the service is fast, available, correct, and within budget, with alerts that notify you before users do—and enough records to investigate every case.
AI systems degrade silently. If you measure latency, quality, cost, and drift, you can spot the problem on Monday morning by checking a dashboard—instead of hearing about it from an important customer on Friday night.
p95 percentile the usual worst case Structured log one JSON line per call Drift the data has changed Alert warns you before the customer
What it is Measure cost and latency by request type and apply cost-saving measures—shorter prompts, output limits, caching, batching, routing, and smaller models—checking the test set to make sure quality hasn't dropped.
AI projects are canceled because of unpredictable costs more often than because of poor quality. Knowing how to estimate, measure, and reduce spending without losing accuracy is what lets you take a pilot to the whole company.
Input × output different prices Prompt caching fixed at the start Route to a small model first Quantization less memory, some quality loss
What it is A process agreed on in advance for detecting, containing, communicating about, and fixing failures, and learning from them. It always ends with a new safeguard—usually one more test case or one more alert.
Every production system will fail at some point. The difference between a five-minute incident and a five-hour one is having a rollback path ready and rehearsed—and the difference between a team that repeats mistakes and one that improves is a postmortem that turns into…
Contain first, investigate later Runbook step-by-step instructions with commands Feature flag turns it off without a deployment Blameless postmortem with a safeguard
⚖️ AI Ethics and Governance
Bias, privacy, LGPD, transparency, copyright, and a simple governance process.
What it is: A chain that runs from principles (what the organization promises) to policies (written rules), processes (who does what and when), and technical controls (what the code checks), with each layer leaving evidence for the one above it.
Laws, contracts, and clients increasingly demand explanations of how AI is used. If you can code and understand governance, you can turn vague requirements into concrete controls—and avoid costly rework when the questions come after launch.
Governance rules, roles, controls Accountability someone is responsible Controls checks with evidence Proportionality effort follows risk
What it is: Measure the system’s outcome and error rates by group, compare them with an agreed threshold, and investigate differences before release—and periodically again in production.
A model with high overall accuracy can make far more errors for a specific group, and the average hides that. Measuring by group is the only way to find out before the problem harms people, leads to a lawsuit, or makes headlines.
Historical bias the past was unequal Parity similar rates Opportunity similar errors Proxy ZIP code instead of race
What it is: Apply the LGPD to the AI lifecycle: know which personal data goes in, the legal basis and purpose for using it, minimize what goes to the model, protect what stays in the logs, and ensure human review and explanations for automated decisions.
Every model call involves data processing. As a programmer, you decide, line by line, what leaves the system and what gets recorded. Understanding the LGPD turns that decision from an invisible legal risk into a simple, testable, documented control.
Legal basis required for every processing activity Minimization only what is necessary Pseudonymization reversible, still personal Art. 20 review of automated decisions
What it is: Make it clear when AI is involved, document the system in a model card, record what is needed to reconstruct each decision, and offer explanations and review to anyone affected.
Transparency lets users trust the system to the right degree, affected people exercise their rights, and the team investigate problems. Without it, a system error can become a trust crisis that is hard to reverse.
AI notice the user knows Model card use, data, limits Explainability why this result Traceability decision linked to version
What it is: Manage the origins and rights of what goes into the system, the licenses for the models and tools used, and the risk that the output copies someone else’s work, with provenance records and human review of anything published.
A model with the wrong license or a dataset assembled from third-party content can force you to rebuild an entire product. Recording origins and licenses from the start costs little and helps avoid disputes that no technical benefit can justify.
Law 9,610/1998 copyright in Brazil Model license read before use Provenance where each piece of data came from Human authorship basis for protection
What it is: Classify each system by the impact of an error and the AI’s autonomy, then choose the level of human oversight, testing, and approval in proportion to that classification.
Risk classification avoids two costly mistakes: burdensome bureaucracy for trivial uses, which leads the team to work around the rules, and unchecked automation in decisions that affect people’s lives. As agents become more autonomous, designing oversight is part of the…
Risk class impact × autonomy Human in the loop approves beforehand Prompt injection hidden instruction in the data Least privilege only what is necessary
What it is: A lightweight, repeatable cycle—record, assess, approve, monitor, and review—with a checklist that follows each system from the first prototype through retirement.
Governance done at the start costs a few hours per system; done after an incident or audit, it costs weeks and damages your reputation. If you master this process, you can bring AI projects into sensitive areas safely—and that is exactly the perspective that…
Inventory what exists and who owns it RIPD impact on data subjects Approval documented before deployment Periodic review and review after every change