> ## Documentation Index
> Fetch the complete documentation index at: https://docs.expectedparrot.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompts and instructions

> Inspect rendered prompts and trace substitutions, instructions, and memory.

The prompt is the full set of instructions and information a model receives to answer a question. EDSL assembles it from question text, answer-format instructions, scenario values, agent instructions, and any prior answers supplied through piping or memory. Reading it helps you see the task from the model's perspective—for example, whether a document passage or an earlier answer is actually present.

## Inspect before execution

This example builds a classification job and renders its prompts without generating answers. Prompt cost information may depend on available model-pricing metadata.

```python theme={null}
from edsl import Agent, Model, QuestionMultipleChoice, Scenario

question = QuestionMultipleChoice(
    question_name="category",
    question_text="Classify this request: {{ scenario.request }}",
    question_options=["Billing", "Access", "Other"],
    answering_instructions="Return one of the listed options. Use Other when neither applies.",
)
agent = Agent(instruction="Apply the coding scheme literally; do not infer missing facts.")
scenario = Scenario({"record_id": "r1", "request": "Please reset my password."})
job = question.by(agent).by(scenario).by(Model())
# Rendering prompts does not generate model responses.
prompts = job.prompts()
```

```python theme={null}
prompts.select("user_prompt", "system_prompt")
```

The table contains `user_prompt` and `system_prompt`: the question-specific material and the surrounding instructions EDSL prepares for the model. Read them together with the row's question and input identifiers. For a classification task, you should see the source text and allowed categories; reference labels kept only for later evaluation should not appear.

## Change instructions deliberately

Use `Agent(instruction=...)` to change respondent instructions. Use a question's `answering_instructions` for answer requirements, and scenario values for varying inputs. Preserve the required response format when customizing instructions.

Piped answers and memory depend on earlier responses. A preview cannot show answers that have not yet been generated. Use the recorded prompts after execution to see the actual earlier answers supplied to a follow-up question. Providers may format these instructions differently, so compare prompts with the selected model in mind.

## Inspect after execution

After running the `job` above with configured model access:

```python theme={null}
results = job.run()
results.select("prompt.*", "answer.*")
```

This executes model calls and may incur costs. Keep the prompts and model settings with your exported answers so that a comparison can be audited.

See [Prompt sensitivity](https://docs.expectedparrot.com/en/latest/research/prompt_sensitivity.md) for comparing alternative wording.

## Common methods

| Call | Arguments and result |
| - | - |
| `job.prompts(iterations=1)` | Return a Dataset of prompts for the planned interviews. |
| `job.show_prompts(all=False)` | Print the user and system prompts; use `all=True` to include every column, including estimated cost. |
| `results.select("prompt.*", "answer.*")` | Inspect the prompts recorded with completed responses. |
| `Prompt("Review {{ message }}")` | Create a reusable text template. |
| `prompt.template_variables()` | List the variable names referenced by the template. |
| `prompt.render({"message": "Export your report"})` | Return a Prompt with values substituted from the dictionary. |

To try a template locally:

```python theme={null}
from edsl import Prompt

prompt = Prompt("Review this message: {{ message }}")
rendered = prompt.render({"message": "Export your report"})
rendered.text
# In a script: print(rendered.text)
```

Rendering this template makes no model call. Use `job.prompts()` to inspect the full instructions that EDSL assembles for a study.

`Prompt.from_txt("instructions.txt")` loads prompt text from a local file. `Prompt.from_template("instructions.jinja2", path_to_folder="templates", **values)` loads and renders a template. Before rendering, `prompt.undefined_template_variables(values)` identifies missing variables and `prompt.unused_traits(values)` identifies supplied keys that the template does not use.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.