一键导入
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 职业分类
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.
| 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) |