DebugAgent
A barebone MVP of an agent-based python debugger. The system is built on top of PDB, the official python debugger.
For the moment, two main things happen:
- The Output of the Pdb debugger becomes the input of the Agent, and viceversa;
- The Agent's actions are limited by a custom Python Interpreter(kindly borrowed from the smolagents library), that limits the harm of the Agent.
This is not by any mean a finished application, but it seems to be working incredebily good as is.
How to use it
The user experience is straight forward:
Clone the package and install(a PyPi version is coming in the future)
git clone https://github.com/marcoslashpro/DebugAgent && cd DebugAgent
uv pip install -e .
That's it for the installation, now you should a debug_agent package from where you can import the agent.
The intended use is as a decorator on the risky function, like this:
from debug_agent import Agent
@Agent
def some_risky_function():
return 'hello' / 10
Once the function raises an exception, then the decorator will launch the post-mortem analysis of the code. The Agent will then start interacting with the debugger, using its commands to analyze the error, outputting a summary of the task at the end of the debugging session.
Optionally, you can also provide parameters to the decorator, which allows us to set a temperature for the model, the n_steps that the agent should take, and the model_id, in order to specify a different model.
Keep in mind tho, that for the moment, the only models available are the one that can be used through the ChatHuggingFace Langchain interface.
Considerations
For the moment, the agent seems to perform pretty well on minor errors, such as ZeroDivisionErrors, TypeError, ValueErrors, while showcasing the ability to dig into the stacktrace in order to find where the error originated from. I think that, as the prompt improves and, if we get to that point, with some debugging-specific fine-tuning, this could become a valuable application for python developers.
Happy Coding!
And come back to me, if you find any problems while using the debugger.
Metadata
Release files for debug-agent 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| debug_agent-0.1.1.tar.gz | 10.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| debug_agent-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.2 kB
Release files / debug_agent-0.1.1.tar.gz
| Download URL | debug_agent-0.1.1.tar.gz |
|---|---|
| Size | 10.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0051fa59ca1bcb7a2fc76aada97ee85722d7c517df0f99207c141112c1a5f4fd
|
|
BLAKE2b-256 checksum How to use checksums |
a2fa1768a2d133b583d2e39380d1c34b18554b90c01a8d6723bbb68d29795ba3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|
Release files / debug_agent-0.1.1-py3-none-any.whl
| Download URL | debug_agent-0.1.1-py3-none-any.whl |
|---|---|
| Size | 10.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e124b86d809877534b11450749f521a32cfefdf1137e927900421bdf40f2cb85
|
|
BLAKE2b-256 checksum How to use checksums |
db9e9d5aa051c2afefbcd57870bdfdd5f86deb1725da376520cb882ec23b6373
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|