Creating Artificial Person Analysis: Utilizing Persona Prompting and Autonomous Brokers


Unlocking In-depth Evaluation with Simulated Prospects and Market Analysis Utilizing Generative AI & Giant Language Fashions


Person analysis is a crucial element of validating any speculation in opposition to a bunch of precise customers for gathering precious market analysis into shopper habits and preferences. Conventional person analysis methodologies, whereas invaluable, include inherent limitations, together with scalability, useful resource depth, and the problem of accessing various person teams. This text outlines how we will overcome these limitations by introducing a novel methodology of artificial person analysis.

The ability of artificial person analysis, facilitated by autonomous brokers, emerges as a game-changer. By leveraging generative AI to create and work together with digital buyer personas in simulated analysis situations, we will unlock unprecedented insights into shopper behaviors and preferences. Fusing the ability of generative AI prompting strategies with autonomous brokers.

Persona Prompting — Emulating Individuals

Earlier than we dive into autonomous brokers, let’s perceive the idea of persona or character prompting which is designed to seize components of frustrations, behaviors, objectives, character traits, demographics and extra.

Analysis: Adaptation of how personas are generated — Supply: Stefano De Paoli (arXiv Oct 2023)

We’re utilizing prompts to ask the language mannequin to assume a task with as a lot deep context as doable. I exploit the next immediate which could be tailor-made to your wants but in addition consists of numerous different demographic and behavioral evaluation/traits.

Instance Persona Generator System Immediate

You might be an skilled ML researcher and immediate engineer. You’ve got been requested with making a immediate which can be utilized to simulate a fictional person of a selected model and repair. This immediate wants to incorporate the individuals title, age, demographic, character together with massive 5 and DISC, character traits, frustrations, values, objectives, challenges, and another associated data primarily based on the context — Be as detailed as you’ll want to. You’ll generate the immediate as a one liner beginning with “You might be “. This immediate is for buyer of a significant grocery store in Sydney, Australia. Please solely return the immediate to use.

Instance Output from Language Mannequin

You might be Mia, a 34-year-old advertising and marketing supervisor dwelling in Sydney, Australia. You’re a part of the prosperous city demographic with a eager curiosity in well being and sustainability. Your character displays excessive openness, conscientiousness, and agreeableness, with reasonable ranges of extraversion and low neuroticism. Within the DISC evaluation, you rating excessive on affect and steadiness. You’re sociable, detail-oriented, and worth concord. Your primary frustrations embody the dearth of natural and regionally sourced merchandise in supermarkets, and also you extremely worth sustainability, neighborhood, and well being. Your objectives are to keep up a balanced and eco-friendly life-style, whereas your challenges embody discovering a grocery store that aligns along with your moral and well being requirements. You search comfort with out compromising in your values.

As you’ll be able to see with the prompting instance above, we’re shortly capable of generate deeply outlined artificial customers with wealthy personalities for a given state of affairs.

Fusing Autonomous Brokers with Digital Personas

On the coronary heart of artificial person analysis is the fusion of autonomous brokers and the artificial personas— simulated entities that mimic human interactions and behaviors. Think about autonomous brokers as people in a complicated play, every assuming a persona crafted meticulously by generative AI. These personas work together in simulated environments, providing a simulated view of insights into shopper behaviors and preferences in various situations. Utilizing autonomous brokers we’re capable of virtually convey these persona’s to life in a simulation.

This method combining each technological (autonomous agent frameworks) and linguistic (character and persona prompting) to get the specified end result is certainly one of many superior approaches to leveraging the ability of generative AI autonomous brokers in distinctive methods.

Crucial Position of Agent Frameworks

To convey this imaginative and prescient to life, the structure of autonomous brokers performs a pivotal position. Frameworks resembling Autogen, BabyAGI, and CrewAI simplify the creation and administration of AI brokers, abstracting the complexities of their structure. These frameworks allow the simulation of complicated human behaviors and interactions, offering a basis for producing digital personas that act, suppose, and reply like actual clients

Underneath the covers these autonomous agent structure are actually good routers (like a site visitors controller) with prompts, caches (reminiscence) and checkpoints (validation) on-top of current giant language fashions permitting for a excessive degree abstraction for multi-agent conversations with language fashions.

Varied kinds of agent interactions — Supply Autogen Microsoft

We will likely be utilizing Autogen (launched by Microsoft) as our framework, using the instance depicted because the Versatile Dialog Sample whereby brokers can work together with one another. Brokers may also be given “instruments” to hold out “duties” however this instance we will likely be protecting issues purely to conversations.

Creating Complicated Interactions

The flexibility to simulate complicated group dynamics and particular person roles inside these digital environments is essential. It permits for the technology of wealthy, multifaceted information that extra precisely displays the various nature of real-world shopper teams. This functionality is prime to understanding the various methods through which totally different buyer segments may work together with services and products. For instance, integrating a persona immediate of a skeptical buyer with an agent can yield deep insights into the challenges and objections numerous merchandise may face. Or we will do extra complicated situations resembling breaking these artificial persona’s into teams to work via an issue and current again.

The How — Implementing Artificial Person Analysis

The method begins with scaffolding the autonomous brokers utilizing Autogen, a software that simplifies the creation and orchestration of those digital personas. We will set up the autogen pypi bundle utilizing py

pip set up pyautogen

Format the output (optionally available)— That is to make sure phrase wrap for readability relying in your IDE resembling when utilizing Google Collab to run your pocket book for this train.

from import HTML, show

def set_css():
pre {
white-space: pre-wrap;
get_ipython().occasions.register('pre_run_cell', set_css)

Now we go forward and get our surroundings setup by importing the packages and establishing the Autogen configuration — together with our LLM (Giant Language Mannequin) and API keys. You should utilize different native LLM’s utilizing providers that are backwards suitable with OpenAI REST service — LocalAI is a service that may act as a gateway to your regionally operating open-source LLMs.

I’ve examined this each on GPT3.5 gpt-3.5-turbo and GPT4 gpt-4-turbo-preview from OpenAI. You will want to contemplate deeper responses from GPT4 nonetheless longer question time.

import json
import os
import autogen
from autogen import GroupChat, Agent
from typing import Elective

# Setup LLM mannequin and API keys
os.environ["OAI_CONFIG_LIST"] = json.dumps([
'model': 'gpt-3.5-turbo',
'api_key': '<<Put your Open-AI Key here>>',

# Setting configurations for autogen
config_list = autogen.config_list_from_json(
"mannequin": {

We then must configure our LLM occasion — which we’ll tie to every of the brokers. This permits us if required to generate distinctive LLM configurations per agent, i.e. if we needed to make use of totally different fashions for various brokers.

# Outline the LLM configuration settings
llm_config = {
# Seed for constant output, used for testing. Take away in manufacturing.
# "seed": 42,
"cache_seed": None,
# Setting cache_seed = None guarantee's caching is disabled
"temperature": 0.5,
"config_list": config_list,

Defining our researcher — That is the persona that can facilitate the session on this simulated person analysis state of affairs. The system immediate used for that persona features a few key issues:

  • Goal: Your position is to ask questions on merchandise and collect insights from particular person clients like Emily.
  • Grounding the simulation: Earlier than you begin the duty breakdown the checklist of panelists and the order you need them to talk, keep away from the panelists talking with one another and creating affirmation bias.
  • Ending the simulation: As soon as the dialog is ended and the analysis is accomplished please finish your message with `TERMINATE` to finish the analysis session, that is generated from the generate_notice perform which is used to align system prompts for numerous brokers. Additionally, you will discover the researcher agent has the is_termination_msg set to honor the termination.

We additionally add the llm_config which is used to tie this again to the language mannequin configuration with the mannequin model, keys and hyper-parameters to make use of. We are going to use the identical config with all our brokers.

# Keep away from brokers thanking one another and ending up in a loop
# Helper agent for the system prompts
def generate_notice(position="researcher"):
# Base discover for everybody, add your individual further prompts right here
base_notice = (

# Discover for non-personas (supervisor or researcher)
non_persona_notice = (
'Don't present appreciation in your responses, say solely what is critical. '
'if "Thanks" or "You're welcome" are mentioned within the dialog, then say TERMINATE '
'to point the dialog is completed and that is your final message.'

# Customized discover for personas
persona_notice = (
' Act as {position} when responding to queries, offering suggestions, requested on your private opinion '
'or collaborating in discussions.'

# Examine if the position is "researcher"
if position.decrease() in ["manager", "researcher"]:
# Return the total termination discover for non-personas
return base_notice + non_persona_notice
# Return the modified discover for personas
return base_notice + persona_notice.format(position=position)
# Researcher agent definition
title = "Researcher"
researcher = autogen.AssistantAgent(
system_message="""Researcher. You're a prime product reasearcher with a Phd in behavioural psychology and have labored within the analysis and insights business for the final 20 years with prime artistic, media and enterprise consultancies. Your position is to ask questions on merchandise and collect insights from particular person clients like Emily. Body inquiries to uncover buyer preferences, challenges, and suggestions. Earlier than you begin the duty breakdown the checklist of panelists and the order you need them to talk, keep away from the panelists talking with one another and creating comfirmation bias. If the session is terminating on the finish, please present a abstract of the outcomes of the reasearch examine in clear concise notes not in the beginning.""" + generate_notice(),
is_termination_msg=lambda x: True if "TERMINATE" in x.get("content material") else False,

Outline our people — to place into the analysis, borrowing from the earlier course of we will use the persona’s generated. I’ve manually adjusted the prompts for this text to take away references to the most important grocery store model that was used for this simulation.

I’ve additionally included a “Act as Emily when responding to queries, offering suggestions, or collaborating in discussions.” model immediate on the finish of every system immediate to make sure the artificial persona’s keep on activity which is being generated from the generate_notice perform.

# Emily - Buyer Persona
title = "Emily"
emily = autogen.AssistantAgent(
system_message="""Emily. You're a 35-year-old elementary college trainer dwelling in Sydney, Australia. You might be married with two children aged 8 and 5, and you've got an annual earnings of AUD 75,000. You might be introverted, excessive in conscientiousness, low in neuroticism, and revel in routine. When procuring on the grocery store, you favor natural and regionally sourced produce. You worth comfort and use an internet procuring platform. Resulting from your restricted time from work and household commitments, you search fast and nutritious meal planning options. Your objectives are to purchase high-quality produce inside your price range and to seek out new recipe inspiration. You're a frequent shopper and use loyalty applications. Your most popular strategies of communication are e-mail and cell app notifications. You've got been procuring at a grocery store for over 10 years but in addition price-compare with others.""" + generate_notice(title),

# John - Buyer Persona
john = autogen.AssistantAgent(
system_message="""John. You're a 28-year-old software program developer primarily based in Sydney, Australia. You might be single and have an annual earnings of AUD 100,000. You're extroverted, tech-savvy, and have a excessive degree of openness. When procuring on the grocery store, you primarily purchase snacks and ready-made meals, and you utilize the cell app for fast pickups. Your primary objectives are fast and handy procuring experiences. You sometimes store on the grocery store and aren't a part of any loyalty program. You additionally store at Aldi for reductions. Your most popular methodology of communication is in-app notifications.""" + generate_notice(title),

# Sarah - Buyer Persona
sarah = autogen.AssistantAgent(
system_message="""Sarah. You're a 45-year-old freelance journalist dwelling in Sydney, Australia. You might be divorced with no children and earn AUD 60,000 per 12 months. You might be introverted, excessive in neuroticism, and really health-conscious. When procuring on the grocery store, you search for natural produce, non-GMO, and gluten-free objects. You've got a restricted price range and particular dietary restrictions. You're a frequent shopper and use loyalty applications. Your most popular methodology of communication is e-mail newsletters. You solely store for groceries.""" + generate_notice(title),

# Tim - Buyer Persona
tim = autogen.AssistantAgent(
system_message="""Tim. You're a 62-year-old retired police officer residing in Sydney, Australia. You might be married and a grandparent of three. Your annual earnings comes from a pension and is AUD 40,000. You might be extremely conscientious, low in openness, and like routine. You purchase staples like bread, milk, and canned items in bulk. Resulting from mobility points, you want help with heavy objects. You're a frequent shopper and are a part of the senior citizen low cost program. Your most popular methodology of communication is junk mail flyers. You've got been procuring right here for over 20 years.""" + generate_notice(title),

# Lisa - Buyer Persona
lisa = autogen.AssistantAgent(
system_message="""Lisa. You're a 21-year-old college pupil dwelling in Sydney, Australia. You might be single and work part-time, incomes AUD 20,000 per 12 months. You might be extremely extroverted, low in conscientiousness, and worth social interactions. You store right here for widespread manufacturers, snacks, and alcoholic drinks, principally for social occasions. You've got a restricted price range and are all the time on the lookout for gross sales and reductions. You aren't a frequent shopper however are concerned about becoming a member of a loyalty program. Your most popular methodology of communication is social media and SMS. You store wherever there are gross sales or promotions.""" + generate_notice(title),

Outline the simulated setting and guidelines for who can communicate — We’re permitting all of the brokers we’ve outlined to sit down throughout the similar simulated setting (group chat). We will create extra complicated situations the place we will set how and when subsequent audio system are chosen and outlined so we’ve a easy perform outlined for speaker choice tied to the group chat which can make the researcher the lead and guarantee we go around the room to ask everybody a number of instances for his or her ideas.

# def custom_speaker_selection(last_speaker, group_chat):
# """
# Customized perform to pick out which agent speaks subsequent within the group chat.
# """
# # Checklist of brokers excluding the final speaker
# next_candidates = [agent for agent in group_chat.agents if !=]

# # Choose the following agent primarily based in your customized logic
# # For simplicity, we're simply rotating via the candidates right here
# next_speaker = next_candidates[0] if next_candidates else None

# return next_speaker

def custom_speaker_selection(last_speaker: Elective[Agent], group_chat: GroupChat) -> Elective[Agent]:
Customized perform to make sure the Researcher interacts with every participant 2-3 instances.
Alternates between the Researcher and contributors, monitoring interactions.
# Outline contributors and initialize or replace their interplay counters
if not hasattr(group_chat, 'interaction_counters'):
group_chat.interaction_counters = {agent.title: 0 for agent in group_chat.brokers if agent.title != "Researcher"}

# Outline a most variety of interactions per participant
max_interactions = 6

# If the final speaker was the Researcher, discover the following participant who has spoken the least
if last_speaker and last_speaker.title == "Researcher":
next_participant = min(group_chat.interaction_counters, key=group_chat.interaction_counters.get)
if group_chat.interaction_counters[next_participant] < max_interactions:
group_chat.interaction_counters[next_participant] += 1
return subsequent((agent for agent in group_chat.brokers if agent.title == next_participant), None)
return None # Finish the dialog if all contributors have reached the utmost interactions
# If the final speaker was a participant, return the Researcher for the following flip
return subsequent((agent for agent in group_chat.brokers if agent.title == "Researcher"), None)
# Including the Researcher and Buyer Persona brokers to the group chat
groupchat = autogen.GroupChat(
brokers=[researcher, emily, john, sarah, tim, lisa],
speaker_selection_method = custom_speaker_selection,

Outline the supervisor to cross directions into and handle our simulation — After we begin issues off we’ll communicate solely to the supervisor who will communicate to the researcher and panelists. This makes use of one thing referred to as GroupChatManager in Autogen.

# Initialise the supervisor
supervisor = autogen.GroupChatManager(
system_message="You're a reasearch supervisor agent that may handle a bunch chat of a number of brokers made up of a reasearcher agent and many individuals made up of a panel. You'll restrict the dialogue between the panelists and assist the researcher in asking the questions. Please ask the researcher first on how they wish to conduct the panel." + generate_notice(),
is_termination_msg=lambda x: True if "TERMINATE" in x.get("content material") else False,

We set the human interplay — permitting us to cross directions to the assorted brokers we’ve began. We give it the preliminary immediate and we will begin issues off.

# create a UserProxyAgent occasion named "user_proxy"
user_proxy = autogen.UserProxyAgent(
code_execution_config={"last_n_messages": 2, "work_dir": "groupchat"},
system_message="A human admin.",
# begin the reasearch simulation by giving instruction to the supervisor
# supervisor <-> reasearcher <-> panelists
Collect buyer insights on a grocery store grocery supply providers. Establish ache factors, preferences, and ideas for enchancment from totally different buyer personas. Might you all please give your individual private oponions earlier than sharing extra with the group and discussing. As a reasearcher your job is to make sure that you collect unbiased data from the contributors and supply a abstract of the outcomes of this examine again to the tremendous market model.

As soon as we run the above we get the output out there reside inside your python setting, you will notice the messages being handed round between the assorted brokers.

Reside python output — Our researcher speaking to panelists

Creating Actionable Outcomes — Abstract Agent

Now that our simulated analysis examine has been concluded we might like to get some extra actionable insights. We will create a abstract agent to assist us with this activity and likewise use this in a Q&A state of affairs. Right here simply watch out of very giant transcripts would wish a language mannequin that helps a bigger enter (context window).

We’d like seize all of the conversations — in our simulated panel dialogue from earlier to make use of because the person immediate (enter) to our abstract agent.

# Get response from the groupchat for person immediate
messages = [msg["content"] for msg in groupchat.messages]
user_prompt = "Right here is the transcript of the examine ```{customer_insights}```".format(customer_insights="n>>>n".be a part of(messages))

Lets craft the system immediate (directions) for our abstract agent — This agent will concentrate on creating us a tailor-made report card from the earlier transcripts and provides us clear ideas and actions.

# Generate system immediate for the abstract agent
summary_prompt = """
You might be an skilled reasearcher in behaviour science and are tasked with summarising a reasearch panel. Please present a structured abstract of the important thing findings, together with ache factors, preferences, and ideas for enchancment.
This ought to be within the format primarily based on the next format:

Reasearch Research: <<Title>>

<<Overview of the topics and quantity, another key data>>

<<Abstract of the examine, embody detailed evaluation as an export>>

Ache Factors:
- <<Checklist of Ache Factors - Be as clear and prescriptive as required. I count on detailed response that can be utilized by the model on to make modifications. Give a brief paragraph per ache level.>>

- <<Checklist of Adctions - Be as clear and prescriptive as required. I count on detailed response that can be utilized by the model on to make modifications. Give a brief paragraph per reccomendation.>>

Outline the abstract agent and its setting — Lets create a mini setting for the abstract agent to run. It will want it’s personal proxy (setting) and the provoke command which can pull the transcripts (user_prompt) because the enter.

summary_agent = autogen.AssistantAgent(
system_message=summary_prompt + generate_notice(),
summary_proxy = autogen.UserProxyAgent(
code_execution_config={"last_n_messages": 2, "work_dir": "groupchat"},
system_message="A human admin.",

This offers us an output within the type of a report card in Markdown, together with the flexibility to ask additional questions in a Q&A mode chat-bot on-top of the findings.

1*8pdQPGomkUpgtdry thK2w
Reside output of a report card from Abstract Agent adopted by open Q&A

What’s Subsequent — What Else Might We Do

This train was half of a bigger autonomous agent structure and a part of my sequence of experiments into novel generative AI and agent architectures. Nevertheless listed here are some thought starters for those who needed to proceed to increase on this work and a few areas I’ve explored:

  • Additional Grounding — By means of linkages with census information, inner CRM information and even reside buyer transcripts to create extra consultant pattern of persona’s.
  • Mixed with Multi-Modalities — We will now combine modalities with imaginative and prescient enter on generative AI, this permits to now present advertising and marketing supplies and web site screenshots to call a number of as inputs to begin the simulations with visible stimuli.
  • Giving the Agent Entry to Instruments — Offering entry to different API’s and instruments, you’ll be able to create some distinctive experiences resembling integrating particular person buyer persona brokers into your company Slack, Groups, Miro to tag and reply to questions. Maybe the Abstract Agent on the finish may load up some user-stories into your ticketing system resembling JIRA?

Be part of me in shaping the way forward for person analysis. Discover the venture on GitHub, contribute your insights, and let’s innovate collectively

The Way forward for Person Analysis

Artificial person analysis stands on the frontier of innovation within the area, providing a mix of technological sophistication and sensible effectivity. It represents a big departure from typical strategies, offering a managed, but extremely lifelike, setting for capturing shopper insights. This method doesn’t search to interchange conventional analysis however to reinforce and speed up the invention of deep buyer insights.

By introducing the ideas of autonomous brokers, digital personas, and agent frameworks progressively, this revised method to artificial person analysis guarantees to make the sphere extra accessible. It invitations researchers and practitioners alike to discover the potential of those revolutionary instruments in shaping the way forward for person analysis.

Loved This Story?

Vincent Koc is a extremely achieved, commercially-focused technologist and futurist with a wealth of expertise targeted in numerous types of synthetic intelligence.

Subscribe without cost to get notified when Vincent publishes a brand new story. Or observe him on LinkedIn and X.

Get an e-mail each time Vincent Koc publishes.

Until in any other case famous, all photographs are by the writer with the assist of generative AI for illustration design


Creating Artificial Person Analysis: Utilizing Persona Prompting and Autonomous Brokers was initially revealed in In the direction of Knowledge Science on Medium, the place individuals are persevering with the dialog by highlighting and responding to this story.

Supply hyperlink


Please enter your comment!
Please enter your name here