Zhenfy

Sessions & Conversations

A session is a conversation thread with an agent. Messages within the same session share context — the agent remembers what was said earlier.

Managing sessions

  • Sessions are created automatically when you send a chat message
  • To continue a conversation, pass the session_id from the previous response
  • In the web UI, the session sidebar lists all conversations. Click one to load its history.
  • Click + New Conversation to start a fresh session

Session API

# Create a named session
curl -s -X POST .../agents/$AGENT_ID/sessions \
  -d '{"name": "Debug Session"}'

# List sessions
curl -s .../agents/$AGENT_ID/sessions

# Get session with message history
curl -s .../agents/$AGENT_ID/sessions/$SESSION_ID

# Send a message in a session
curl -s -X POST .../agents/$AGENT_ID/sessions/$SESSION_ID/messages \
  -d '{"message": "What did we discuss earlier?"}'

# Delete a session
curl -s -X DELETE .../agents/$AGENT_ID/sessions/$SESSION_ID