Metadata-Version: 2.4
Name: debug_agent
Version: 0.1.0
Summary: Add your description here
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jinja2>=3.1.6
Requires-Dist: langchain
Requires-Dist: langchain-huggingface>=0.3.0
Requires-Dist: langgraph>=0.4.10
Requires-Dist: pydantic>=2.11.7
Requires-Dist: requests>=2.32.4
Requires-Dist: smolagents>=1.19.0
Dynamic: license-file

# 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:

1. The Output of the Pdb debugger becomes the input of the Agent, and viceversa;
2. 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.
