ワンクリックで
edsl-agent-reference
EDSL agent reference - AgentList operations, trait manipulation, templates, codebooks, and instructions
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
EDSL agent reference - AgentList operations, trait manipulation, templates, codebooks, and instructions
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Analyze EDSL Results objects - load by UUID or file path, export survey documentation, and generate analysis reports
Answer questions about a generated analysis report - reads report artifacts, performs additional analysis if needed, and saves the answer with metadata
Design complete surveys from free text requirements - generates a Python script with Survey, ScenarioList, and AgentList definitions
Design a detailed experimental plan from a research question - includes literature review, randomization plan, survey design, power analysis, and sample size recommendation
Save/load Surveys, Agents, and AgentLists locally, push/pull to Expected Parrot cloud, git versioning
EDSL survey reference - question types, templating, rules, memory, helpers, and visualization
| name | edsl-agent-reference |
| description | EDSL agent reference - AgentList operations, trait manipulation, templates, codebooks, and instructions |
| allowed-tools | Read, Glob, Bash(python:*) |
Consolidated reference for working with Agents and AgentLists in EDSL: list operations, trait manipulation, templates, codebooks, and instructions.
Operations for manipulating collections of agents.
agents = agents.give_names("respondent_id")
agents = agents.give_names("first_name", "last_name", remove_traits=False)
agents = agents.give_names("city", "id", separator="_")
agents = agents.give_uuid_names()
sample = agents.sample(n=10, seed=42)
shuffled = agents.shuffle(seed=42)
train, test = agents.split(frac_left=0.8, seed=42)
combined = agents1 + agents2
collapsed = agents.collapse()
from edsl import AgentDelta, AgentListDeltas
deltas = AgentListDeltas({
"Alice": AgentDelta({"age": 31, "status": "promoted"}),
"Bob": AgentDelta({"age": 26})
})
updated_agents = agents.apply_deltas(deltas)
dataset = agents.to_dataset()
scenarios = agents.to_scenario_list()
df = agents.to_pandas()
agent = agents[0]
subset = agents[0:5]
first = agents.first()
last = agents.last()
agent = agents.at(3)
for agent in agents:
print(agent.traits)
results = survey.by(agents).run()
results = agents.to(survey).run()
| Operation | Method |
|---|---|
| Name from traits | agents.give_names("trait") |
| UUID names | agents.give_uuid_names() |
| Sample | agents.sample(n=10, seed=42) |
| Shuffle | agents.shuffle(seed=42) |
| Split | agents.split(frac_left=0.8) |
| Combine | agents1 + agents2 |
| Collapse | agents.collapse() |
| Apply deltas | agents.apply_deltas(deltas) |
| To Dataset | agents.to_dataset() |
| To ScenarioList | agents.to_scenario_list() |
| To DataFrame | agents.to_pandas() |
| First/Last | agents.first(), agents.last() |
All trait operations return new instances (immutable pattern).
# Single agent
agent = agent.add_trait("weight", 150)
agent = agent.add_trait({"weight": 150, "height": 5.5})
# AgentList - single value for all agents
agents = agents.add_trait("status", value="participant")
# AgentList - different values per agent (must match length)
agents = agents.add_trait("score", values=[85, 90, 78, 92])
agent = agent.update_trait("age", 31)
# Single agent
agent = agent.drop("temporary_id")
agent = agent.drop("temp1", "temp2")
# AgentList
agents = agents.drop("temporary_id")
agents = agents.drop("temp1", "temp2", "temp3")
agent = agent.keep("age", "occupation")
agents = agents.keep("age", "occupation")
agents = agents.select("age", "occupation") # Alias
agent = agent.rename("old_name", "new_name")
agent = agent.rename({"old1": "new1", "old2": "new2"})
agents = agents.rename("old_name", "new_name")
agents = agents.translate_traits({
"gender": {1: "male", 2: "female", 3: "other"},
"education": {1: "high school", 2: "bachelor", 3: "graduate"}
})
agents = agents.numberify()
young_agents = agents.filter("age < 30")
doctors = agents.filter("occupation == 'doctor'")
young_doctors = agents.filter("age < 30 and occupation == 'doctor'")
alice = agents.filter("name == 'Alice'")
# Remove agents with None/NaN values
clean_agents = agents.filter_na()
clean_agents = agents.filter_na(["age", "income"])
| Operation | Single Agent | AgentList |
|---|---|---|
| Add trait | agent.add_trait("key", value) | agents.add_trait("key", values=[...]) |
| Update trait | agent.update_trait("key", value) | N/A |
| Drop trait | agent.drop("key") | agents.drop("key") |
| Keep traits | agent.keep("k1", "k2") | agents.keep("k1", "k2") |
| Rename trait | agent.rename("old", "new") | agents.rename("old", "new") |
| Filter | N/A | agents.filter("age > 30") |
| Filter NA | N/A | agents.filter_na() |
| Translate | agent.translate_traits({...}) | agents.translate_traits({...}) |
| Numberify | N/A | agents.numberify() |
Controls how agent traits appear in LLM prompts.
Without a template, traits are shown as a dictionary:
Your traits: {'age': 30, 'occupation': 'doctor'}
With a codebook but no custom template:
Your traits:
Age in years: 30
Current profession: doctor
Templates use Jinja2 syntax with access to trait values:
from edsl import Agent, AgentList
agent = Agent(
traits={"age": 30, "occupation": "doctor", "city": "Boston"},
traits_presentation_template="You are a {{age}}-year-old {{occupation}} living in {{city}}."
)
agents = agents.set_traits_presentation_template(
"You are a {{age}}-year-old {{occupation}} living in {{city}}."
)
Inside templates, you can reference:
{{age}}, {{occupation}}{{traits}}{{codebook}}Codebooks map trait keys to human-readable descriptions.
agent = Agent(
traits={"age": 30, "occ": "MD"},
codebook={"age": "Age in years", "occ": "Occupation code"}
)
agents = agents.set_codebook({
"age": "Age in years",
"income": "Annual income in USD",
"edu": "Highest education level"
})
agent = Agent(
traits={"age": 30},
instruction="Answer honestly based on your life experience."
)
agents = agents.set_instruction("Answer as if you were this person.")
agents = agents.add_instructions("Answer honestly and thoughtfully.")
Dynamic traits are computed at question-answering time:
def dynamic_func(question):
if "income" in question.question_text.lower():
return {"disclosure_level": "private"}
return {"disclosure_level": "public"}
agent = Agent(
traits={"age": 30},
dynamic_traits_function=dynamic_func
)
# Map questions to relevant traits
agents = agents.set_dynamic_traits_from_question_map({
"hometown_question": ["hometown", "state"],
"food_question": ["favorite_food", "dietary_restrictions"]
})
| Task | Single Agent | AgentList |
|---|---|---|
| Set codebook | Agent(..., codebook={...}) | agents.set_codebook({...}) |
| Set instruction | Agent(..., instruction="...") | agents.set_instruction("...") |
| Set template | Agent(..., traits_presentation_template="...") | agents.set_traits_presentation_template("...") |
| View codebook | agent.codebook | agents.codebook |
| View instruction | agent.instruction | agents.instruction |
| View template | agent.traits_presentation_template | agents.traits_presentation_template |