Skip to content
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

Add PythonCodeAgent #896

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Add PythonCodeAgent #896

wants to merge 4 commits into from

Conversation

ahuang11
Copy link
Contributor

Since LLMs excel at coding and Panel can almost wrap anything, I think it's good to add an arbitrary code executor.

Not sure how to control the formatting though. In the first view spec, the code is properly spaced with new lines. The second view spec is condensed. Ideally, it'd use the | yaml syntax for multi line strings, but not sure how to specify that.

image

@ahuang11 ahuang11 requested a review from philippjfr December 23, 2024 21:10
@ahuang11 ahuang11 changed the title Add code agent Add PythonCodeAgent Dec 23, 2024
Copy link

codecov bot commented Dec 23, 2024

Codecov Report

Attention: Patch coverage is 84.93151% with 22 lines in your changes missing coverage. Please review.

Project coverage is 52.01%. Comparing base (ee60b84) to head (09170f0).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lumen/ai/agents.py 9.09% 10 Missing ⚠️
lumen/views/base.py 86.88% 8 Missing ⚠️
lumen/ai/models.py 0.00% 3 Missing ⚠️
lumen/ai/utils.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #896      +/-   ##
==========================================
+ Coverage   51.65%   52.01%   +0.35%     
==========================================
  Files         108      108              
  Lines       13700    13846     +146     
==========================================
+ Hits         7077     7202     +125     
- Misses       6623     6644      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@philippjfr
Copy link
Member

Seems very scary to me, what if a user asks the LLM to write code that destroys the system or exfiltrate secrets?

@ahuang11
Copy link
Contributor Author

ahuang11 commented Dec 24, 2024

Yes I thought of that which is why it's not part of the default agents, but I suppose it could add a disclaimer to use at the user's own risk. It could be useful for contained, authenticated environments.

@philippjfr
Copy link
Member

Would be nice if this could somehow be run in a sandboxed environment, e.g. pyodide or some other WASM based Python environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants