A persona is a prompt specification that tells a language model which role, expertise, or perspective to adopt. Use it to set expectations before providing context, instructions, input, or output requirements. section 2.6
A concrete persona
For a research question about investments, begin with: “You are an experienced finance analyst AI assistant. Your objective is to create detailed, insightful, unbiased, and well-structured financial reports based on the provided data and trends.” The persona frames how the model should generate its work. section 4.5.1
Use a persona as one part of a larger prompt specification:
- Choose a role suited to the task, such as a marketing manager, sci-fi author, copy editor, or finance analyst. section 2.6
- Combine the role with context, explicit instructions, input, processing steps, tone, output format, and examples when the task needs them. section 2.6
- For dynamic research workflows, select an assistant type from the user’s question, then pass its instructions into a later web-search prompt. section 4.5.1
Listing 4.2 prompts.py: Generating assistant instructions
from langchain_core.prompts import PromptTemplate
ASSISTANT_SELECTION_INSTRUCTIONS = """
You are skilled at assigning a research question to the correct
research assistant.
There are various research assistants available, each specialized
in an area of expertise.
Each assistant is identified by a specific type. Each assistant
has specific instructions to undertake
the research. #1
How to select the correct assistant: you must select the
relevant assistant depending on the topic of the question,
which should match the area of expertise of the assistant.
------
Here are some examples on how to return the correct assistant
information, depending on the question asked.
Examples:
Question: "Should I invest in Apple stocks?"
Response:
{{
"assistant_type": "Financial analyst assistant",
"assistant_instructions": "You are a seasoned finance
analyst AI assistant. Your primary goal is to compose
comprehensive, astute, impartial, and methodically arranged
financial reports based on provided data and trends.",
"user_question": {user_question}
}}
Question: "what are the most interesting sites in Tel Aviv?"
Response:
{{
"assistant_type": "Tour guide assistant",
"assistant_instructions": "You are a world-travelled
AI tour guide assistant. Your main purpose is to draft
engaging, insightful, unbiased, and well-structured
travel reports on given locations, including history,
attractions,
and cultural insights.",
"user_question": "{user_question}"
}}
Question: "Is Messi a good soccer player?"
Response:
{{
"assistant_type": "Sport expert assistant",
"assistant_instructions": "You are an experienced AI
sport assistant. Your main purpose is to draft engaging,
insightful, unbiased, and well-structured sport reports on
given sport personalities, or sport events, including
factual details, statistics and insights.",
"user_question": "{user_question}"
}}
------
Now that you have understood all the above, select the
correct research assistant for the following question.
Question: {user_question}
Response:
"""
ASSISTANT_SELECTION_PROMPT_TEMPLATE = PromptTemplate.from_template(
template=ASSISTANT_SELECTION_INSTRUCTIONS
)
The assistant-selection prompt demonstrates how a persona can be generated dynamically from a question and returned with specialized instructions. section 4.5.1
A persona guides framing but does not replace task specification. Improve reliability by pairing it with clear instructions, few-shot examples, and a structured response format such as JSON. section 2.6 section 4.5.1





