Beyond Prompts: Context Engineering for Intelligent Systems
Parna Mehta20:552026
Un agente de IA sin contexto podría reservarte un hotel en Paris, Kentucky
Pide a un agente basado solo en prompts que reserve un hotel en París para una conferencia y puede que elija el primer Paris que encuentre: el de Kentucky. Para quien lleva IA agéntica a producción, la fiabilidad depende menos del modelo que de lo que le llega. Parna Mehta, ingeniera de AIOps en AWS responsable de la precisión de sistemas agénticos y RAG, plantea qué necesita saber un modelo y qué descartar cuando se acaba el espacio.
Descubre los componentes, principios y prioridades de depuración detrás de agentes de IA fiables
Parna Mehta, AI Ops Engineer en AWS, sostiene que la IA agéntica lista para producción depende menos de prompts ingeniosos que de diseñar todo el contexto que recibe un modelo: instrucciones del sistema, historial de conversación, conocimiento recuperado, salidas de herramientas, perfil del usuario y estado del flujo de trabajo. Con ejemplos de atención al cliente y reserva de hoteles, explica cuatro principios del contexto eficaz y cómo priorizar y depurar una ventana de contexto finita y costosa.
“Y si algo sale mal, no culpes al modelo. Ve y revisa tu contexto.”
“Pero como ingeniero de contexto, la pregunta será: ¿qué información debo presentar a mi LLM o qué debe saber el modelo?”
What you will learn
Distinguir la ingeniería de contexto de la ingeniería de prompts, pasando de preguntar qué decirle al modelo a preguntar qué debe saber el modelo.
Identificar las seis fuentes de contexto que necesita un agente: instrucciones del sistema, historial de conversación, datos recuperados, salidas de herramientas, perfil del usuario y estado del flujo de trabajo.
Aplicar cuatro principios (exactitud, precisión, cohesión y concisión) para decidir qué entra en la ventana de contexto.
Priorizar, resumir, comprimir y depurar el contexto para controlar el coste de tokens, la latencia y la calidad de las respuestas en producción.
Colocar la información importante al principio y al final del contexto para sortear el problema de "perdido en el medio".
Details
Level
Intermediate
Format
Talk
Technical depth
Practitioner
For
Early career, Mid-career, Senior individual contributor
Length
20:55
Published
June 2026
Questions this talk answers
¿Qué es la ingeniería de contexto y en qué se diferencia de la ingeniería de prompts?
Es la práctica sistemática de diseñar, estructurar y optimizar todo el sistema de información que se presenta a un LLM. Quien hace ingeniería de prompts se pregunta qué decirle al modelo; quien hace ingeniería de contexto se pregunta qué debe saber el modelo.
¿Qué compone el contexto de un agente de IA?
Instrucciones del sistema, historial de conversación, datos recuperados mediante RAG y bases de conocimiento, interacciones con herramientas y sus salidas, el perfil del usuario y el estado actual del flujo de trabajo. Juntos forman la ventana de contexto de instrucciones, conocimiento y herramientas.
¿Por qué no llenar simplemente una gran ventana de contexto con todo?
Los tokens son finitos y caros, más tokens suponen más coste y latencia, y saturar al modelo puede empeorar la calidad de la respuesta. Solo debe entrar la información adecuada.
¿Qué conviene descartar primero cuando se llena la ventana de contexto?
Los componentes de menor prioridad, como los ejemplos few-shot y partes del historial de conversación. Las instrucciones del sistema nunca deben eliminarse.
¿Qué hacer cuando un agente produce malos resultados?
No culpar al modelo, sino revisar el contexto. Tratar el contexto como un sistema, con el mismo rigor que se aplicaría a un pipeline de datos.
Perdido en escena: por qué los LLM necesitan contexto (78 s)
El problema de Paris, Kentucky (88 s)
No culpes al modelo, revisa el contexto (80 s)
Parna Mehta: All right, folks, thank you so much for joining in on time and taking our time to join my session. A very warm welcome to my session on Context Engineering for Intelligent Systems. My name is Parna. I work for AWS and I'm an AIOps engineer. So my day to day life is spent in cloud and AI/ML. And I'm glad that I'm able to do this on the cloud.
I've shared my insights with you and I'm loving the atmosphere here and love all the motivation and inspiration I'm getting from the other sessions as well. So thank you so much for joining in. We start. So just imagine that you've gone for a play to attend a play of your friend and you are backstage and suddenly you realize that the main character is unwell and they just hand over a script to you and just tell you you've got 10 minutes and you've got to perform.
These are your lines and they push you after 10 minutes. So imagine you are standing on the stage. You have your lines, but you have no clue. You don't have any clue about the context. What are the props? There is a seat over there. You don't know. Are you supposed to sit there? Are you supposed to use it? There are other actors and actresses on the stage. You don't know how you are going to interact with them. You don't know your audience. And finally, you don't know your play. You're lost without context. So imagine this is exactly the the way a LLM would feel if you would just give it a few lines of query and ask it to perform and give it its best performance. Do you think it will perform that well? Of course it won't,
right? So the systematic practice of designing, structuring and optimizing your entire information system before you present it to your LLM is actually the funda of context engineering. In plain prompt engineering, you just have a user input which you pass to the LLM and the LLM through its learned knowledge and its previous trainings, it's going to give you the best answer possible. But that's not good enough in this age. In this age of agentic AI, you need an entire information system to pass information dynamically at the right time of the right quantity and of the right relevance to the LML to get the best response. So what does this have in it? It has the user input, it has memory of past interaction, it will be your rag retrieved documents, it could
have the state of the workflows. Suppose your agent is doing a multi-step workflow, it's a complex workflow, it has to remember which step it is on, right? Plus, it has to have awareness of all its tools. All this assembled together is presented to your LLM and this is known as context engineering. So previously, as a context engineer, sorry, as a prompt engineer, you would focus on what should I say to the LLM or what should my instruction be? But as a context engineer, it will be what information should I present to my LLM or what should the model know? Now, it is an entirely art and science of dynamically curating all this information from different sources, external, internal files, the user input from memory. All of these together is dynamically given at the right time to the LLM
at runtime. Now, which are the components of your context engineering? So the first and foremost component would be your system instructions. Now, what are system instructions? So this is the guiding principle of your agent, right? What is its goal? What is its persona? What is it supposed to do? How is it supposed to behave? The entire guideline is given in your system instructions. This is the most important.
Then comes your conversation history. So if it's a multi-turn interaction, you are constantly talking to your agent and giving it queries or instructions or fine tuning your instructions further. That information also forms part of your context. Then, of course, you have facts. You have your enterprise data. So you're going to retrieve them through your RAG systems and knowledge bases. That is going to be your other source of context. Of course, the brain without hands is of no use. So they're going to be actions or tool interactions. So every time a tool is called, whatever responses the tool is given, that is also your context. Then the person who's actually interacting with your agent, the user, their profile, they could be a customer, they could be an administrator, they could be a developer, they could be anyone. So information
about that user will also alter the way the agent will behave. And finally, what state it is in. So if it is taking a multi-step process, it is following a standard operating procedure, which step it is on, that also the agent needs to remember. All of this become a part of your context. Now, when you package all of them together, this little box is known as your context window. Now your context window will be made up on the high level of instructions, like your system instructions, past memories, maybe you've given it few examples of how you want the output to be, your tool descriptions, all that policies, guidelines, all that form your instructions. Then comes the knowledge, knowledge is from your RAG sources, or it could even be your steering docs, okay, which will steer the behavior of your agent.
It could be best practices. All of this will form your knowledge. And then you have the tools. Tools are not only the actions that the LLM can take, but also the output of those tool actions that it has taken. It has to remember that. All this together in a little box is known as the context window. Now, in a traditional customer service interaction, you can see over here, I hope you can. There is a customer who comes in and says, I'm having trouble with my subscription renewal. It has been renewed twice. Now, a traditional way of a bot or a chat agent would be, I'm sorry to hear that. Can I get your account number or your email address?
That's the way they're going to identify who's coming. So you'll obviously give your email address. So you can see Sarah has given their email address. Again, the bot is going to ask you, can you verify your billing address for security? You must have heard this before. So it'll ask you the second level of identification. Sarah provides that. See, it's still it's not really got to the point. Then it's going to ask you, OK, tell me about your subscription.
When did you notice this double charge? And it still doesn't know that the user is on a pro plan or on a basic plan doesn't have any clue. It's not using its context information. And this can go on. And after a while, maybe the agent will say, oh, looks like I need to transfer you to another agent.
This is wasted time, right? You could spend anywhere between 10 minutes to 40 minutes to an hour just doing back and forth and realizing you just have been transferred. But how is it different in a context engineered support? Now, over here, say Sarah has come in, in the background, the agent would have already preloaded information about Sarah, that they are on a pro plan.
They have started their subscription, say, n months ago, and maybe it has already detected there was a double charge that was charged to Sarah's account. So it has already collected all that information in the back end. So it doesn't need to ask what is your email address or what is your billing address. It doesn't need to know that. So it can directly say, hey, Sarah, it welcomes you in a personalized way.
I can see that you already have a duplicate charge of twenty nine dollars and you are on a pro plan. And in the background, it probably already has a playbook or a standard operating procedure, what to do in case of a duplicate charge. So it has that playbook already in its context. So it knows what to do next.
So it says over here, in case there's a duplicate charge and it's below fifty dollars, offer them a refund. OK, we want to wow our customers. So you can see immediately the agent has already asked for initiating a refund. Right. So you can see how fast the interaction has flowed just in a couple of seconds or minutes, I would say.
And you see that the customer also gets wowed by it. Right. That was fast, you know. So when will I get it? Probably in the next month. Will it happen now or in the next month? But it already has that answer because it knows that a refund will be initiated. It will come back in about two, three days. It has all that information.
So it can give it to this. So this is the difference between a prompt engineer and a context engineer. I'll give you another example. Also, say Sarah comes in again and she's saying that she's having trouble with her recent order and she's given her recent order number in the background. So in the background, you'll see that the agent has already collected her user profile information that she's been a premium customer.
She's spent X amount of dollars in her past interactions. What is her current order? All the information is already there, where it is at this stage for tracking purpose, because the agent is preempting that probably Sarah is going to ask about tracking or some problem related to the last order. So it has all that information. Plus, it has previous memories of historic memories of the previous interactions as well.
It knows that there was a damage package in the last delivery that happened. So it has information about that, too. Now, all this together, plus its overarching goal as an agent, it knows at every stage I need to wow the customer. OK, so for every interaction, I need to raise the customer sentiments high, get a high customer rating.
I should try and do that in whatever way possible, having all this context. Now, when you go through the interaction, you see it already knows that it's speaking to Sarah knows all the information about the package. So it can instantly tell Sarah that, hey, it's going to be shipped in three days. And this is your tracking number and estimation time is tomorrow, day after, whatever.
And because it already had context that Sarah was a premium customer, it knows that premium customers usually like expedited delivery. So it will jump on that and it will say that, hey, do you want me to expedite it at no cost to you? Because she is a privileged customer at all. So this is everything without Sarah having to say anything and it is already offered to the customer.
Obviously, you know that Sarah will be really happy and she says that's great. And then she talks about her previous order. Remember that the agent already knows about it, right? It has context. And she asks, I had a problem with my previous order. There was a packaging issue and the agent already knows about it and it knows it has to wow the customer.
So it says that, yes, I do remember. I know the order number as well because it has the interaction history and I know it had damaged packaging. So I have ensured that you get reinforced packaging this time. And I'm going to wow you by giving you an additional 15% discount because it knows from previous interaction that this customer likes getting discounts and refunds.
And it's got a high rating because of that. All this put together, you can see what a splendid interaction this has become all because of context engineering. So that was one example just to showcase about context engineering. Now, going into what forms, what are the principles of effective context engineering? Now, this agent will effectively work only if it is given accurate information.
So if it's not given the right information, probably the background query would have given past interaction of some other customer. Then it would have landed up giving wrong information, right, to Sara. So having the correct information is very important. Also, for example, when you're talking to an AI agent and giving it information about files, if you've given it a wrong file path, then you've given it a file name which has another file with the same name.
So it will keep searching for it. So giving it the right file path, right location, right query from the database to get the customer data, for example, is very important. Preciseness. Now, preciseness is ensuring that you exactly let the agent know what you need. So for example, if this is a coding agent, if you just give it a piece of code and ask it to improve it or make it better, that's not precise.
So it might just go ahead and make some changes to the variable naming or it might just, you know, reorder and add some good comments. But probably what you meant was refactor my code, modularize my code, or if you would have been very specific, you could have said add a validation for null values. So it exactly knows what to do.
So preciseness is very important. Cohesiveness. Now, the information that is coming from different sources, the signal to noise ratio should be large. So there should not be unnecessary information which is flooding your context. For example, you want the agent to help you understand or refactor a particular function, then providing it with the entire code based on the repository information is unnecessary.
You're just wasting tokens or you're just wasting that finite context window that you have. Here, the amount of noise is more, but when you focus on an area, the agent will perform better. Conciseness is giving just the right amount of information, not too much, not too little. So, for example, if you are going to ask your agent to debug a problem in your code and you're going to give it logs, would you give it logs for that time period that you saw the problem or would you give it logs for the entire month?
It's better to give it only for that time period, right? So just the right amount of information, not too much. So these are some guiding principles. Let me take you to another problem. This is a fun one. It's called as the Paris, Kentucky problem. Yeah. Did you know that there is a Paris in Kentucky? When I was doing my research, I found out that there is a Paris there, too.
Now, think of a typical prompt engineered agent. And you said, book me a hotel in Paris for the Women in Tech Global Conference. Nothing else. No context. Nothing. Now, this agent will pick the first Paris that comes in its search and it might pick the one in Kentucky. But actually, the Paris conference possibly is in France. It did not bother to look that up.
And it went and booked you into one of the hotels, which probably you don't approve of. So you've not given it much information. So it's just gone and did what it felt like. Okay. So this is a complete failure. Now, think of a context engineered agent. It will first go and search up all the conferences, women in tech conferences, which are happening around the world, which are upcoming.
And it will search and give that there is one happening in Paris, France. So you got verified output. That is one. Then it knows that you cannot just go and book a hotel or an airline, which falls outside your company policy. So you will have corporate limits. So the agent needs to purchase based on that limit. So it will gather and retrieve that information from your rag sources.
Plus, it knows your user preferences. It has interacted with you before. It knows your preferred chain of hotels as well. So what you get is a correct, compliant and a very personalized response. So this is the power of context engineering. Now, there are different components. As you can see, there is a system prompt, user message, tool descriptions, agent responses, retrieve data and tool outputs.
Out of all of these, your static components are your system prompt and your tool descriptions. The remaining will keep growing in size. But remember, in production, your context window is finite and you have to prioritize amongst each component. Now, which component will you remove if you have to drop it from a context? The one with the least priority.
You will never remove your system instructions, right? We'll come to that. But just to give you an idea that what is exactly context window. Say you have a small window and you ask the agent, how many buildings can you see? It can see three buildings. But if you have large French windows, it can actually see multiple buildings.
It has more information. So you might be tempted to flood it with a lot of information. Now, remember, your context window is made up of tokens. Tokens are expensive. There is a finite limit to these tokens. As we have more advanced models, obviously, they have a bigger context window. But the question is, don't put everything into the context window.
Put only the right information. Okay. Because tokens have a cost to it. More number of tokens, meaning more cost. More tokens, meaning latency will also increase. You don't want your user waiting forever. Sometimes you see agents, it goes into this thinking loop. And your quality might deteriorate because you're overwhelming it. So of course, when you're going into production, all these factors are really important.
There are agents which are smart, which can actually tell you which components fill out which part of your context. So you get an idea of how much your context is remaining. You can take some active steps to actually go and summarize it yourself and compress it or prune it or get rid of some past interaction. Or the agent might summarize it when it hits that limit.
Now, which all things need to be dropped is very important. I've shown you there's a priority. This is also priority. So if at the lowest end is your few short examples, you'd rather get rid of that and some part of your conversation than have a non-compliant output, which you saw in the Paris, Kentucky problem. Apart from that, there are other pitfalls also.
Remember, your LLMs have this lost in the middle problem. It tends to lose focus on context in the middle and always focuses on the end. So you can use some strategies such that your important tokens are always towards the beginning and end. Of course, you can make sure that your token, your context window is not overwhelmed. It is not confused with large number of outputs from conflicting instructions or outputs from tools such that it fails.
Finally, I would leave you with this relevance is more important than the volume. Context is a system. It's not just a single prompt. It is a whole system treated with the same rigor that you would do for a data pipeline. And if something is going wrong, do not blame the model. Go and look at your context. Finally, I would say the context window is the new idea.
Go and explore and build something great. Thank you so much. And I think the future of AI engineers is by being great context architects. Thank you so much for being and attending my session. This is my QR code to my LinkedIn. Please feel free to connect with me and I'd love to know how you found this session.
Thank you so much.
Transcribed automatically; names checked against the speaker record. Select a time to jump there.
Article based on this talk
Por qué los agentes de IA fiables dependen del contexto, no de prompts ingeniosos
Parna Mehta, de AWS, explica qué necesita saber un agente, cómo evaluar un buen contexto y qué recortar cuando se llena la ventana.
En resumen
Parna Mehta, AI Ops Engineer en AWS, sostiene que los agentes de IA en producción triunfan o fracasan según la información que reciben, no según una redacción ingeniosa. Para ella, la ingeniería de contexto es la práctica de diseñar todo el sistema de información en torno a un modelo: instrucciones, memoria, conocimiento recuperado, salidas de herramientas, perfil del usuario y estado del flujo de trabajo, entregados en el momento adecuado y en la cantidad adecuada. Su consejo final es sencillo: cuando un agente falla, revisa el contexto antes de culpar al modelo.
Puntos clave
Qué es la ingeniería de contexto y por qué importa
Tipos de contexto
Técnicas de ingeniería de contexto
Buenas prácticas y errores comunes que evitar
Un actor con un guion y sin contexto
Mehta abre con una escena: estás entre bastidores en la obra de una amiga, el actor principal enferma y diez minutos después te empujan al escenario solo con tus líneas. No conoces la utilería, a los demás actores, al público ni siquiera la obra. "Y, por último, no conoces tu obra. Estás perdido sin contexto". (0:59)
Así, dice, se siente un modelo de lenguaje de gran tamaño cuando solo recibe unas pocas líneas de consulta. La ingeniería de prompts pasa la entrada del usuario al modelo y confía en lo que aprendió durante el entrenamiento. En la era de la IA agéntica, argumenta, eso ya no basta: el modelo necesita todo un sistema de información que le aporte información relevante de forma dinámica, en tiempo de ejecución. El cambio de mentalidad se reduce a una pregunta: "Pero como ingeniero de contexto, la pregunta será: ¿qué información debo presentar a mi LLM o qué debe saber el modelo?" (2:37)
Qué entra en la ventana de contexto
Mehta enumera los componentes de los que se nutre un agente. Primero, y lo más importante, las instrucciones del sistema: el objetivo del agente, su persona y el comportamiento esperado. Después vienen el historial de conversación de interacciones de varios turnos, los datos e información empresarial recuperados mediante sistemas RAG y bases de conocimiento, las llamadas a herramientas y sus respuestas, el perfil del usuario (un cliente, un administrador o un desarrollador) y el estado de cualquier flujo de trabajo de varios pasos o procedimiento operativo estándar. Sobre las herramientas es tajante: "Por supuesto, un cerebro sin manos no sirve de nada". (4:04)
Empaquetados juntos, estos elementos forman la ventana de contexto, que ella agrupa en tres bloques. Las instrucciones abarcan el prompt del sistema, memorias previas, ejemplos few-shot, descripciones de herramientas, políticas y directrices. El conocimiento abarca fuentes RAG, documentos de orientación y buenas prácticas. Las herramientas abarcan tanto las acciones disponibles para el modelo como los resultados de las acciones que ya ha realizado.
Dos conversaciones con clientes, con y sin contexto
Para concretar la diferencia, Mehta recorre un chat de soporte. Una clienta llamada Sarah informa de una suscripción que se renovó dos veces. El bot tradicional le pide su correo electrónico, luego su dirección de facturación, luego cuándo notó el cargo, todo ello sin saber qué plan tiene, y puede terminar transfiriéndola a otro agente. "Esto es tiempo perdido, ¿verdad?" (7:32)
En la versión con ingeniería de contexto, el agente ya ha cargado el plan pro de Sarah, su historial de suscripción y el cargo duplicado de 29 $, junto con un manual que indica reembolsar los cargos duplicados inferiores a 50 $. La saluda por su nombre, inicia el reembolso y le dice cuándo llegará el dinero. Un segundo ejemplo añade el seguimiento de pedidos, interacciones anteriores y un objetivo general de encantar al cliente: el agente ofrece envío urgente gratuito a un cliente premium, recuerda un paquete que llegó dañado, promete un embalaje reforzado y añade un descuento. "Con todo esto junto, podéis ver qué interacción tan espléndida se ha logrado, todo gracias a la ingeniería de contexto". (12:16)
Cuatro principios y el problema de Paris, Kentucky
A continuación, Mehta expone cuatro principios del contexto eficaz. Exactitud: las entradas erróneas, como el historial de otro cliente o una ruta de archivo ambigua, llevan a respuestas erróneas. Precisión: pedir a un agente de programación que mejore el código invita a cambios cosméticos, mientras que pedirle que añada una validación para valores nulos le indica exactamente qué hacer. Cohesión: mantener alta la relación señal-ruido, así que no entregues un repositorio entero para refactorizar una sola función. "Solo estás desperdiciando tokens o desperdiciando esa ventana de contexto finita que tienes". (14:32) Concisión: al depurar, comparte los logs del periodo en que apareció el problema, no los de todo el mes.
A su siguiente ejemplo lo llama uno divertido: el problema de Paris, Kentucky. Si se le pide reservar un hotel en París para la Women in Tech Global Conference sin más contexto, un agente basado solo en prompts puede elegir el primer Paris que encuentre, quizá el de Kentucky, y un hotel que no aprobarías. Un agente con ingeniería de contexto verifica primero dónde se celebra la conferencia, recupera los límites de viajes corporativos de las fuentes RAG y aplica tus preferencias de hotel conocidas. "Así que lo que obtienes es una respuesta correcta, conforme a la política y muy personalizada". (16:42)
Gestionar una ventana finita y costosa
Los modelos más avanzados ofrecen ventanas de contexto más grandes, y Mehta reconoce la tentación de llenarlas. Su advertencia es que los tokens son finitos y caros. "Más tokens significa más coste. Más tokens significa que la latencia también aumentará". (18:13) Sobrecargar el modelo también puede reducir la calidad, y los agentes pueden quedarse atrapados en bucles de razonamiento.
Los prompts del sistema y las descripciones de herramientas permanecen estáticos, mientras que los mensajes del usuario, las respuestas del agente, los datos recuperados y las salidas de herramientas no dejan de crecer. Por eso los equipos necesitan priorizar, resumir, comprimir y depurar, ya sea de forma activa o dejando que el agente resuma cuando alcance su límite. Cuando haya que quitar algo, elimina primero los elementos de menor prioridad, como los ejemplos few-shot y partes de la conversación, y nunca las instrucciones del sistema. También señala el problema de "perdido en el medio", en el que los modelos pierden el foco sobre el contenido situado en la mitad del contexto, y recomienda mantener los tokens importantes cerca del principio y del final.
Sus principios de despedida: la relevancia importa más que el volumen, y el contexto es un sistema que debe tratarse con el mismo rigor que un pipeline de datos. "Y si algo sale mal, no culpes al modelo. Ve y revisa tu contexto". (20:00)
Mira la charla
Beyond Prompts: Context Engineering for Intelligent Systems, de Parna Mehta, 21 minutos: https://www.womentech.net/video/beyond-prompts-context-engineering-intelligent-systems
Sobre la ponente
Parna Mehta es AI Ops Engineer en AWS y profesional de cloud e IA/ML con 8 certificaciones de AWS y más de 12 años de experiencia en el sector; garantiza la calidad, fiabilidad y precisión de sistemas de IA agéntica y de GenAI basados en RAG. Su regreso profesional tras una pausa de 13 años ha sido reconocido con los premios AWS SheDares, AWS Empower.eve y HerRising, y contribuye como mentora y como coorganizadora principal de la comunidad BeSA Cloud.
Preguntas que responde esta charla
¿Qué es la ingeniería de contexto y en qué se diferencia de la ingeniería de prompts?
¿Qué compone el contexto de un agente de IA?
¿Por qué no llenar simplemente una gran ventana de contexto con todo?
¿Qué conviene descartar primero cuando se llena la ventana de contexto?
¿Qué hacer cuando un agente produce malos resultados?
Redactado con IA a partir de la transcripción de la charla. Pendiente de revisión editorial.