Waking and Sleeping Sailor Agents

Revised 7/9/2002 by Seth Russell

[sailor agent home]
The Perdicament
Sailor agents accumulate information from many contexts as they read and write from the semantic web and interact with their users.  Currently this information is stored in RAM and is not recorded in a persistent database.  Starting with version .090 sailor agents can store a copy of their memory in .bed files when they are put to sleep and resume operations when they left off when they are awoken.  
Putting a sailor agent to sleep
Use the following method from a python application:
me.sleep()
Or just click the button sleep on the top of the appOne.html application running  from your sailorServer.

When this method is called the entire contexts of the agents memory is written to a file in the homePath directory with the agents name as the file name and .bed as the file extension.  
Waking a sailor agent up
A sailor agent is woken up in a python application by making an instance of the class wake:
me=sailor.wake('AGENT_NAME')
Or by starting a sailorServer and designating the 'AGENT_NAME' as the 3rd argument; for example:
homePath> python sailorServer.py , , sailors
The agent will respond in one of two ways.  If a agent with that name has never been put to sleep, the the response will be:
new born AGENT_NAME
However if there is a .bed file in the homePath directory, the agent will respond:
woke up from homePath\AGENT_NAME.bed
The sailor agent wakes up with all it's memory just exactly as it was when it was put to sleep.  Even it's attention and mem stack remain unchanged.