How to save session id in the session parameters in a generative playbook?

I am using conversational agent in google using https://conversational-agents.cloud.google.com/ and want to store session id as session parameter using generative playbook how do I do this?

I am using a generative routine playbook.

I tried creating custom variable using current_session_idand tried to assign like below

current_session_id = $request.session_id but is not working

Also created a code block like below and called from the playbook but no luck.

@Action

def get_current_session_id() → str:

state[“$session.params.current_session_id”] = state[“$request.session-id”]

return “”

I am calling this agent from outside and I need to persist the session_id in the session for troubleshooting

I got to do it adding in the default start flow in parameter presets a new parameter with name: current_session_id and value: $request.session-id

Then adding current_session_id as a read parameter in my playbook.

Hope this helps!