Skip to main content
Short-term sessions store conversation events for the same userID and sessionID. They support multi-turn context, tool-call history, and event recovery.

Minimal Runner Example

For local development, use ADK Go’s session.InMemoryService(). Reusing the same userID and sessionID gives the agent access to the same conversation history.
context.Context controls cancellation, deadlines, and request-scoped values. It is not the conversation context. Conversation state comes from userID, sessionID, and ShortTermMemory / SessionService.

Persistent Short-Term Sessions

session.InMemoryService() is fine for examples and single-process debugging, but data disappears when the process exits. Production deployments should use persistent storage. VeADK Go provides the NewShortTermMemoryService entry point:
Available backends: When config is nil, VeADK reads the matching database config from the global config. Pass the backend-specific config struct when you need explicit settings.

App Integration

When using a VeADK Go app launcher, apps.RunConfig.ShortTermMemory is an alias for SessionService. It uses the same session concept as direct Runner usage.
Simple app, A2A app, and AgentKit server app all use the configured session service in the runtime path. The app owns the HTTP or protocol entry point; Runner is better when you call the agent directly inside your Go process.

Multi-Turn Rules

Reuse the same userID and sessionID for multi-turn conversations. A different sessionID starts a new conversation. A different userID should be treated as a different user context even when the session ID string is the same.

Session versus Long-Term Memory

They can be configured together. Short-term sessions keep one conversation continuous. Long-term memory lets separate conversations recall important information.

Troubleshooting

Last modified on October 20, 2026