| name | edsl-persistence-reference |
| description | Save/load Surveys, Agents, and AgentLists locally, push/pull to Expected Parrot cloud, git versioning |
| allowed-tools | Read, Glob, Bash(python:*) |
EDSL Persistence Reference
Consolidated reference for saving, loading, and sharing EDSL objects (Surveys, Agents, AgentLists) locally and via the Expected Parrot cloud.
Local File Persistence (save/load)
Saving to Local Files
from edsl import Survey, Agent, AgentList
survey.save("my_survey")
agent.save("my_agent")
agents.save("my_agents")
survey.save("my_survey", compress=False)
Loading from Local Files
from edsl import Survey, Agent, AgentList
survey = Survey.load("my_survey")
agent = Agent.load("my_agent")
agents = AgentList.load("my_agents")
File Format Details
- Compressed (default):
.json.gz - gzip-compressed JSON, smaller file size
- Uncompressed:
.json - plain JSON, human-readable
- The
load() method auto-detects the format based on file extension
Cloud Persistence (push/pull)
Objects can be stored on the Expected Parrot cloud platform for sharing and collaboration.
Pushing to the Cloud
response = survey.push()
response = agents.push()
response = survey.push(
description="Customer satisfaction survey Q4 2024",
alias="customer-satisfaction",
visibility="private"
)
response = survey.push(
alias="customer-satisfaction",
force=True
)
Pulling from the Cloud
survey = Survey.pull("123e4567-e89b-12d3-a456-426614174000")
agents = AgentList.pull("123e4567-e89b-12d3-a456-426614174000")
survey = Survey.pull("https://expectedparrot.com/content/123e4567...")
survey = Survey.pull("https://expectedparrot.com/content/username/customer-satisfaction")
survey = Survey.pull("username/customer-satisfaction")
Listing Cloud Objects
my_surveys = Survey.list()
my_agents = AgentList.list()
public_surveys = Survey.list(visibility="public")
matching = Survey.list(search_query="customer satisfaction")
page_2 = Survey.list(page=2, page_size=20)
oldest_first = Survey.list(sort_ascending=True)
Managing Cloud Objects
Survey.patch(
"123e4567-e89b-12d3-a456-426614174000",
description="Updated description",
visibility="public"
)
survey.patch(
"123e4567-e89b-12d3-a456-426614174000",
description="Added question 4"
)
Survey.delete("123e4567-e89b-12d3-a456-426614174000")
Visibility Levels
| Level | Description |
|---|
"private" | Only you can access |
"unlisted" | Anyone with the URL/UUID can access (default) |
"public" | Discoverable and accessible by everyone |
Git-Based Versioning
survey.git_push("my-survey")
agents.git_push("my-agent-population")
survey = Survey.git_clone("username/my-survey")
agents = AgentList.git_clone("username/my-agent-population")
Serialization to Dict/JSON/YAML
d = survey.to_dict()
survey = Survey.from_dict(d)
json_str = survey.to_json()
yaml_str = survey.to_yaml()
survey = Survey.from_yaml(yaml_str)
survey.to_yaml(filename="survey.yaml")
survey = Survey.from_yaml(filename="survey.yaml")
SurveyList Persistence
from edsl import SurveyList
surveys = SurveyList([survey1, survey2, survey3])
surveys.save("my_surveys")
surveys = SurveyList.load("my_surveys")
surveys.push(description="Survey collection", alias="my-survey-collection")
surveys = SurveyList.pull("uuid-or-alias")
Quick Reference
| Task | Survey | Agent | AgentList |
|---|
| Save locally | survey.save("file") | agent.save("file") | agents.save("file") |
| Load locally | Survey.load("file") | Agent.load("file") | AgentList.load("file") |
| Push to cloud | survey.push(alias="...") | agent.push(alias="...") | agents.push(alias="...") |
| Pull from cloud | Survey.pull("uuid") | Agent.pull("uuid") | AgentList.pull("uuid") |
| List on cloud | Survey.list() | Agent.list() | AgentList.list() |
| Delete from cloud | Survey.delete("uuid") | Agent.delete("uuid") | AgentList.delete("uuid") |
| To dict | survey.to_dict() | agent.to_dict() | agents.to_dict() |
| From dict | Survey.from_dict(d) | Agent.from_dict(d) | AgentList.from_dict(d) |