Skip to main content
EDSL is an open-source library for simulating surveys, experiments and other research with AI agents and large language models. Before running the code below, please ensure that you have installed the EDSL library and either activated remote inference from your Expected Parrot account or stored API keys for the language models that you want to use with EDSL. Please also see our documentation page for tips and tutorials on getting started using EDSL.

Designing the task as an EDSL survey

We design the task as an EDSL survey about the survey to be converted: a series of questions prompting a language model to read and reformat the contents of a given survey. The formatted responses of the language model are readily usable components of a new EDSL survey that can be administered to AI agents and/or human audiences.

Creating a meta-survey

We start by selecting appropriate question types for reformatting the contents of a given survey. EDSL comes with many common question types that we can choose from based on the form of the response that we want to get back from a model: multiple choice, checkbox, free text, linear scale, etc. Here we use QuestionList to return information about all the questions in the survey at once, as a list. We create a sequence of questions, using the response to one question as an input to the next question. This step-wise approach can improve performance by allowing a model to focus on distinct tasks, and also allow us to pinpoint modifications to instructions as needed (some models will perform better and need fewer instructions than others). Note that we use a {{ placeholder }} for the text of the survey to be reformatted that we want to add to the initial question, which allows us to reuse it with other content (e.g., another survey):
First we ask the model to return just the questions from the survey:
Next we ask the model to format the questions as dictionaries, and specify the question text and type:
Next we ask the model to add the question options (if any):
Finally, we ask the model to give each question a name:
Next we combine the questions into a Survey in order to administer them together. We add a “memory” of each prior question in the survey so that the model will have the context and its answers on hand when answering each successive question:

Adding content to questions

Next we create a Scenario object for the contents of a (non-EDSL) survey to be inserted in the first question. This allows us to reuse the questions with other content. Learn more about using scenarios to scale data labeling and other tasks. Here we create a scenario for a Google Form (a customer feedback survey) that we have stored as a publicly-accessible PDF at Expected Parrot. Code for posting a PDF to Expected Parrot (rerun with your own file):
Creating a scenario for the content:
Scenario

Selecting language models

EDSL works with many popular language models that we can select to use in generating survey responses. You can provide your own API keys for models or activate remote inference to run surveys at the Expected Parrot server with any available models. Learn more about working with language models and using remote inference.
A list of all available models can be viewed at the model pricing and performance page.
Here we select several models to compare their responses:

Running a survey

Next we add the scenario and models to the survey and run it. This generates a dataset of Results that we can access with built-in methods for analysis. Learn more about working with results.
To see a list of all the components of the results that have been generated:
We can filter, sort, select and print components in a table:

Creating a new EDSL survey

Now we can construct a new EDSL survey with the reformatted components of the original survey. This is done by creating Question objects with the question components, passing them to a new Survey, and then optionally designing and assigning AI agents to answer the survey. Here we select one of the model’s responses to use:
We can inspect the survey that has been created:
Survey # questions: 10; question_name list: [‘visit_frequency’, ‘overall_satisfaction’, ‘recommendation_likelihood’, ‘store_cleanliness’, ‘staff_friendliness’, ‘product_variety’, ‘product_prices’, ‘age_range’, ‘gender’, ‘additional_comments’];

Designing AI agents

EDSL comes with methods for designing AI agent personas for language models to use in answering questions. An Agent is created by passing a dictionary of relevant traits. It can then be assigned to a survey using the by() method when the survey is run (the same as we do with scenarios and models). We can import existing data to create agents representing audiences of interest, or use EDSL to generate personas:
If we do not specify a model to use in running the question, the default model gpt-5.2 is used:
Note:Note that the personas can be (much) longer and include key/value pairs for any desired traits; we keep it simple here for demonstration purposes. Here we pass the personas to a list of agents and have them answer the survey:

Posting to Expected Parrot

Expected Parrot is a platform for creating, storing and sharing LLM-based research. It is fully integrated with EDSL and accessible from your workspace or Expected Parrot account page. Learn more about creating an account and the platform. Here we demonstrate how to post this notebook: