lumen icon indicating copy to clipboard operation
lumen copied to clipboard

Add PythonCodeAgent

Open ahuang11 opened this issue 1 year ago • 4 comments

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 avatar Dec 23 '24 21:12 ahuang11

Codecov Report

:x: Patch coverage is 84.93151% with 22 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 52.01%. Comparing base (ee60b84) to head (09170f0). :warning: Report is 384 commits behind head on main.

Files with missing lines Patch % Lines
lumen/ai/agents.py 9.09% 10 Missing :warning:
lumen/views/base.py 86.88% 8 Missing :warning:
lumen/ai/models.py 0.00% 3 Missing :warning:
lumen/ai/utils.py 0.00% 1 Missing :warning:
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     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Dec 23 '24 21:12 codecov[bot]

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

philippjfr avatar Dec 24 '24 20:12 philippjfr

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.

ahuang11 avatar Dec 24 '24 21:12 ahuang11

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

philippjfr avatar Dec 30 '24 11:12 philippjfr

Stale

ahuang11 avatar Dec 09 '25 17:12 ahuang11