-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
refactor(tools): overhaul Python REPL component with modern tool mode #5463
base: main
Are you sure you want to change the base?
Conversation
BREAKING CHANGE: Complete redesign of PythonREPL component architecture - Replace legacy tool mode with modern tool_mode=true implementation - Add automatic import detection for both global and from-imports - Remove manual global_imports field in favor of automatic detection - Implement CodeInput type support with FieldTypes.CODE - Update schema to handle new parameters for agent compatibility - Improve error handling and logging for import failures The component now automatically handles imports without manual configuration, supports modern tool mode, and provides better integration with the agent system through updated schema definitions.
CodSpeed Performance ReportMerging #5463 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, @Vigtu !
Thank you
icon = "Python" | ||
name = "PythonREPL" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Name is not required
name = "PythonREPL" |
StrInput( | ||
name="global_imports", | ||
display_name="Global Imports", | ||
info="A comma-separated list of modules to import globally, e.g. 'math,numpy'.", | ||
value="math", | ||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We had imports for security reasons. We need a way to limit what the LLM can do.
- Add explicit global imports input for security control - Set both global_imports and python_code as required fields - Remove AST-based import analysis in favor of explicit imports
Removed overly broad exception handling to comply with linting rules.
BREAKING CHANGE: Complete redesign of PythonREPL component architecture
The component now automatically handles imports without manual configuration, supports modern tool mode, and provides better integration with the agent system through updated schema definitions.
Python REPL Overhaul.json
code used on the example:
Or just run the code without the Agent:
CodeInput terminal:
the output: