[FEATURE] Provide session manager access in AgentInitializedEvent
Problem Statement
The session manager is not accessible in the AgentInitializedEvent hook. This prevents us from rehydrating conversation history when resuming paused conversations, forcing us to recreate agents for each invocation.
Proposed Solution
Include the session manager in the AgentInitializedEvent context, similar to how it's available in other events. This would allow hook handlers to access and modify conversation history during agent initialization.
Use Case
We are building a persistence layer for agent state. When an agent is resumed:
- The AgentInitializedEvent fires
- Our hook needs to load the previous conversation history from the persistence backend
- The session manager should be populated with this history before the agent continues
Without session manager access at this point, we cannot implement seamless conversation continuation.
Alternatives Solutions
We currently work around this by recreating agents with pre-populated history, but this adds latency and complexity.
Additional Context
No response
@nagabharann can you expand why you need access to the session-manager directly?
The session-manager itself is a hook provider that registers for AgentInitializedEvent (see https://github.com/strands-agents/sdk-python/blob/8fa9c12a3aab1d2d6a7d8bb999d7f2daf1351d39/src/strands/agent/agent.py#L265) and so it's usually responsible for populating the agent. Why have a hook trigger the session-manager instead of letting the session-manager do it?
This issue has been automatically closed as it was marked for auto-closure by the team and no additional responses was received within 7 days.
Ok so looks like we can just workaround by creating our own Session Manager instead and repopulate the agent when the AgentInitializedEvent event fires.