Module 03: Sessions
Understanding session creation and lifecycle in ACP.What You’ll Learn
- Creating sessions with
NewSessionRequest - Working directory context and context documents
- Multiple independent sessions
How Sessions Work
Sessions are workspaces for conversations. Each session has a unique ID assigned by the agent, a working directory context, and its own conversation history. Multiple sessions on the same connection are fully independent.The Code
After initializing (Module 01/02), the next step is creating a session.NewSessionRequest takes a working directory path and an optional list of MCP server configs. The agent returns a session ID that you use for all subsequent prompts: