-
Notifications
You must be signed in to change notification settings - Fork 214
feat: Add automatic session management to Code Interpreter tool #284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add automatic session management to Code Interpreter tool #284
Conversation
- Make session_name parameter optional in all action models - Implement auto-session mode with _ensure_session() method - Enable automatic session creation when sessions don't exist - Update tool description to prioritize common use cases - Improve developer experience by reducing manual session management
Head branch was pushed to by a user without write access
src/strands_tools/code_interpreter/agent_core_code_interpreter.py
Outdated
Show resolved
Hide resolved
src/strands_tools/code_interpreter/agent_core_code_interpreter.py
Outdated
Show resolved
Hide resolved
src/strands_tools/code_interpreter/agent_core_code_interpreter.py
Outdated
Show resolved
Hide resolved
…ved large tool description formatting changes from this PR
src/strands_tools/code_interpreter/agent_core_code_interpreter.py
Outdated
Show resolved
Hide resolved
src/strands_tools/code_interpreter/agent_core_code_interpreter.py
Outdated
Show resolved
Hide resolved
|
Looks like there are some test failures, is there something needed in the test account to enable these? |
Head branch was pushed to by a user without write access
3384ade
@dbschmigelski - i noticed that and i just updated the integration test file and it passes locally.. can you do manual approval so that it proceeds with the integration test |
Description
This PR introduces automatic session management for the Code Interpreter tool, significantly improving the developer and LLM user experience by eliminating the need for manual session initialization in common use cases.
Motivation:
Current implementation requires explicit session initialization before any code execution:
Key Changes:
Optional
session_nameParameter (models.py)session_nameoptional withNonedefault in all action modelsAutomatic Session Management (
agent_core_code_interpreter.py)auto_sessionparameter (defaults toTrue) to enable/disable automatic session creationdefault_sessionparameter (defaults to"default") for unnamed sessions_ensure_session()method to handle session lifecycleImproved Tool Description (
code_interpreter.py)Before vs After:
Related Issues
Addresses developer feedback regarding Code Interpreter tool complexity and performance concerns in multi-step agent workflows.
Documentation PR
N/A - Tool description has been updated inline. No additional documentation changes required at this time.
Type of Change
Enhancement to Existing Tool
Testing
Unit & Integration Tests:
Local Testing:
Performance Impact:
[X ] I ran
hatch run prepareChecklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.