Blog / AI agents
Context engineering for AI agents: a practical guide
Short answer
Context engineering is the practice of deciding what an AI agent sees at each step: which instructions, documents, tool results and history go into its context, in what form and within what budget. It replaced prompt engineering as the main lever on agent quality because agents work over many steps and many sources.
With troveGEN
troveGEN supplies the knowledge part of an agent’s context: the few cited passages that answer each step, limited to what the requester may see.
From prompts to context
A prompt is one message. An agent runs a loop: it plans, calls tools, reads results and decides again. What it knows at each turn is the sum of its instructions, the conversation so far, tool outputs and retrieved knowledge. Context engineering designs that sum.
The parts of an agent’s context
- Instructions: the role, rules and output format
- Task state: the goal, the plan and what has been done
- Retrieved knowledge: passages and figures from your documents, with sources
- Tool results: answers from APIs, calculators and searches
- Memory: facts carried over from earlier sessions, where the application keeps them
Common mistakes
- Too much: whole documents pasted in, burying the relevant line and raising cost
- Too little: an agent asked about a policy it was never given
- Wrong source: an old or unverified document treated as current
- Leaks: content the end user may not see reaching the agent, and then the user
- No sources: answers that cannot be checked, so errors go unnoticed
- Numbers by guesswork: totals the model estimates instead of computing
Good practice
- Retrieve, do not paste: search for the few passages that answer the current step
- Keep provenance: every passage carries its document, page and section
- Apply permissions before ranking, so restricted content never enters the context
- Compute exact figures with a tool, and give the agent the result
- Prefer an honest "not found" to the closest wrong passage
- Measure: keep a set of real questions and check that the right passages come back
Key takeaways
- Context engineering decides what an agent sees at every step.
- Retrieval with sources and permissions is the core of it for company knowledge.
- Measure retrieval on your own questions; do not tune by feel.
How troveGEN helps with context engineering
troveGEN handles the retrieved-knowledge part of an agent’s context: it returns the few cited passages that answer a question, exact table totals, and an honest empty result when nothing fits, under the caller’s permissions. Its evaluation tools write test questions from your own documents and score search and answers.
What troveGEN provides
- Retrieval of cited passages per question
- Exact figures computed from tables
- Permissions applied before ranking
- Honest empty results instead of the closest wrong passage
- Evaluation sets written from your own documents
Frequently asked questions
What is context engineering?
Designing what information an AI agent receives at each step: instructions, task state, retrieved knowledge, tool results and memory, within a size budget.
How is it different from prompt engineering?
Prompt engineering shapes one message. Context engineering designs everything an agent reads across a multi-step task, including what is retrieved from documents.
What tools help with context engineering?
A context engine or retrieval service for documents, tools for exact calculations, and an evaluation set to check that the right material is found.
How does troveGEN help with context engineering?
troveGEN supplies the knowledge part of an agent’s context: the few cited passages that answer each step, limited to what the requester may see. It provides: Retrieval of cited passages per question; Exact figures computed from tables; Permissions applied before ranking; Honest empty results instead of the closest wrong passage; Evaluation sets written from your own documents.