session_state
dictionary that you can use to cache intermediate results. The session_state
is tied to a session_id
and can be persisted to a database.
Provide your workflows with storage
to enable persistence of session state in a database.
For example, you can use the SqliteWorkflowStorage
to cache results in a Sqlite database.
run()
method, you can read from and add to the session_state
as needed.
session_state
for that particular session_id
is read from the database and when the workflow ends, the session_state
is stored in the database.
self.write_to_storage()
to save the session_state
to the database at any time. In case you need to abort the workflow but want to store the intermediate results.