ワンクリックで
agent-lists
Patterns for creating EDSL AgentLists from various sources: lists, CSV, Excel, DataFrame, and programmatic combinations.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Patterns for creating EDSL AgentLists from various sources: lists, CSV, Excel, DataFrame, and programmatic combinations.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | agent-lists |
| description | Patterns for creating EDSL AgentLists from various sources: lists, CSV, Excel, DataFrame, and programmatic combinations. |
IMPORTANT:
nameis a reserved keyword forAgent(). UseAgent(name='...', traits={...})— never putnameinside thetraitsdict. Puttingnamein traits raisesAgentNameError.
IMPORTANT:
instructionsis a parameter ofAgentList.from_source()only — it is NOT accepted by theAgentList()constructor. To add instructions when building an AgentList manually, setinstructionon each Agent:Agent(traits={...}, instruction="Answer as if...").
IMPORTANT: All agents in an
AgentListmust have the sameinstructionstring. EDSL raisesAgentListErrorif any agent's instruction differs. Use traits for individuality (persona, background, demographics) and a single shared instruction for behavioral guidance. If agents don't need special instructions, omitinstructionentirely.
from edsl import Agent, AgentList
agent1 = Agent(name="Alice", traits={"age": 25, "occupation": "teacher"})
agent2 = Agent(traits={"age": 35, "occupation": "doctor"})
agents = AgentList([agent1, agent2])
The from_source() method auto-detects the source type:
from edsl import AgentList
# From CSV file
agents = AgentList.from_source("people.csv")
# From Excel file
agents = AgentList.from_source("data.xlsx", sheet_name="Participants")
# From dictionary
agents = AgentList.from_source({
"age": [25, 30, 35],
"name": ["Alice", "Bob", "Charlie"],
"occupation": ["teacher", "doctor", "engineer"]
})
# From pandas DataFrame
import pandas as pd
df = pd.DataFrame({"age": [25, 30], "city": ["NYC", "LA"]})
agents = AgentList.from_source(df)
agents = AgentList.from_source(
"people.csv",
instructions="Answer as if you were this person",
codebook={"age": "Age in years", "income": "Annual income in USD"},
name_field="respondent_name"
)
# Or load codebook from a CSV file (2 columns: key, description)
agents = AgentList.from_source("people.csv", codebook="codebook.csv")
from edsl import Agent, AgentList
from itertools import product
ages = [25, 35, 45]
occupations = ["teacher", "doctor", "engineer"]
agents = AgentList([
Agent(traits={"age": age, "occupation": occ})
for age, occ in product(ages, occupations)
])
# Creates 9 agents (3 ages x 3 occupations)
from edsl import Agent, AgentList
agents = AgentList([
Agent(name="Person A", traits={"role": "CEO", "age": 45, "company": "Acme"}),
Agent(name="Person B", traits={"role": "CTO", "age": 38, "company": "Acme"}),
])
| Source | Example |
|---|---|
| List of Agents | AgentList([agent1, agent2]) |
| CSV file | AgentList.from_source("file.csv") |
| Excel file | AgentList.from_source("file.xlsx", sheet_name="Sheet1") |
| Dictionary | AgentList.from_source({"col": [1, 2, 3]}) |
| DataFrame | AgentList.from_source(df) |
Saving EDSL objects locally and publishing them to Coop (Expected Parrot's servers).
Templates for the standard EDSL study files: survey, scenarios, agents, models, and create_results.py.
Error logging protocol using append-only JSONL format (errors.jsonl).
Developer tool: find the most recent errors.jsonl from an agent run, diagnose root causes, and interactively patch the agent's instruction files to prevent recurrence.
Using FileStore to wrap files (images, PDFs, data) for use in EDSL survey scenarios.
Launching EDSL surveys for real human respondents via humanize, including scenario methods, Prolific integration, and retrieving responses.