Context engineering fits instructions, tool history, and retrieved evidence into a model call. Long-term memory keeps confirmed preferences across sessions. Test whole tool turns, version precedence, deletion, and replay.
An agent lets the model decide the next step in a loop, and its reliability comes from the code around the loop: validation, write confirmation, step limits and evaluation. Build one with Qwen3-4B, measure on 12 support cases what guardrails catch, and learn prompt injection, MCP and pass^k.
Design the prompt as a task interface: write a task spec, layer system, examples and context, separate format errors from wrong judgments with an eval set, and use data to decide when few-shot, chain-of-thought or structured output pays off. Includes a runnable ticket-triage experiment.
A program can use model output reliably through prompt conventions, JSON mode, JSON Schema constrained decoding, and validate-and-retry. This page explains how token masks guarantee a format, how function-call messages flow, and why format limits can hurt reasoning.
How to build a retrieval-augmented generation system that works: clean and chunk documents, combine dense and BM25 retrieval with RRF, rerank with a cross-encoder, assemble the context, and measure every step with Hit@k and MRR on a small runnable corpus.
ReAct treats thought as an action: a model alternates thoughts, tool calls and observations in one trace, from a few examples and without parameter updates. This post covers the paper's four tasks, rechecks its tables, and compares four prompts with Qwen3-4B on a fictional wiki.
Chain-of-thought (CoT) prompting writes the intermediate steps into few-shot exemplars so a model reasons before it answers; with eight exemplars PaLM 540B rises from 17.9% to 56.9% on GSM8K. It rechecks the paper's tables and compares direct answers, filler dots and CoT on Qwen2.5 models.