debug-agent-py 0.2.1__tar.gz → 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. debug_agent_py-0.3.0/PKG-INFO +277 -0
  2. debug_agent_py-0.3.0/README.md +226 -0
  3. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/pyproject.toml +5 -1
  4. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/inspectors/__init__.py +6 -0
  5. debug_agent_py-0.3.0/src/debug_agent/inspectors/celery.py +231 -0
  6. debug_agent_py-0.3.0/src/debug_agent/inspectors/django.py +278 -0
  7. debug_agent_py-0.3.0/src/debug_agent/inspectors/flask_ext.py +171 -0
  8. debug_agent_py-0.3.0/src/debug_agent/inspectors/jinja2.py +214 -0
  9. debug_agent_py-0.3.0/src/debug_agent/inspectors/redis.py +285 -0
  10. debug_agent_py-0.3.0/src/debug_agent/inspectors/signals.py +115 -0
  11. debug_agent_py-0.3.0/src/debug_agent_py.egg-info/PKG-INFO +277 -0
  12. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent_py.egg-info/SOURCES.txt +6 -0
  13. debug_agent_py-0.3.0/src/debug_agent_py.egg-info/requires.txt +36 -0
  14. debug_agent_py-0.2.1/PKG-INFO +0 -160
  15. debug_agent_py-0.2.1/README.md +0 -123
  16. debug_agent_py-0.2.1/src/debug_agent_py.egg-info/PKG-INFO +0 -160
  17. debug_agent_py-0.2.1/src/debug_agent_py.egg-info/requires.txt +0 -18
  18. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/setup.cfg +0 -0
  19. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/__init__.py +0 -0
  20. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/chat_session.py +0 -0
  21. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/config.py +0 -0
  22. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/context_compressor.py +0 -0
  23. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/engine.py +0 -0
  24. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/inspectors/async_tasks.py +0 -0
  25. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/inspectors/database.py +0 -0
  26. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/inspectors/framework.py +0 -0
  27. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/inspectors/http_tracker.py +0 -0
  28. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/inspectors/memory.py +0 -0
  29. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/inspectors/modules.py +0 -0
  30. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/inspectors/runtime.py +0 -0
  31. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/inspectors/system.py +0 -0
  32. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/inspectors/threads.py +0 -0
  33. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/llm_client.py +0 -0
  34. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/middleware.py +0 -0
  35. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/system_prompt_builder.py +0 -0
  36. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/tool_registry.py +0 -0
  37. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/web/__init__.py +0 -0
  38. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent/web/chat_page.py +0 -0
  39. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent_py.egg-info/dependency_links.txt +0 -0
  40. {debug_agent_py-0.2.1 → debug_agent_py-0.3.0}/src/debug_agent_py.egg-info/top_level.txt +0 -0
@@ -0,0 +1,277 @@
1
+ Metadata-Version: 2.4
2
+ Name: debug-agent-py
3
+ Version: 0.3.0
4
+ Summary: AI-powered runtime debugging agent for Python web applications
5
+ Author-email: ggcode <noreply@ggcode.dev>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/topcheer/python-debug-agent
8
+ Project-URL: Repository, https://github.com/topcheer/python-debug-agent
9
+ Project-URL: Issues, https://github.com/topcheer/python-debug-agent/issues
10
+ Keywords: debug,debugging,ai,llm,runtime,diagnostics,flask,fastapi,django,agent,observability
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Topic :: Software Development :: Debuggers
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ Requires-Dist: httpx>=0.27
24
+ Provides-Extra: fastapi
25
+ Requires-Dist: fastapi>=0.100; extra == "fastapi"
26
+ Requires-Dist: starlette>=0.27; extra == "fastapi"
27
+ Requires-Dist: uvicorn>=0.23; extra == "fastapi"
28
+ Provides-Extra: flask
29
+ Requires-Dist: flask>=2.3; extra == "flask"
30
+ Provides-Extra: django
31
+ Requires-Dist: django>=4.2; extra == "django"
32
+ Provides-Extra: sqlalchemy
33
+ Requires-Dist: sqlalchemy>=2.0; extra == "sqlalchemy"
34
+ Requires-Dist: flask-sqlalchemy>=3.0; extra == "sqlalchemy"
35
+ Provides-Extra: redis
36
+ Requires-Dist: redis>=5.0; extra == "redis"
37
+ Provides-Extra: celery
38
+ Requires-Dist: celery>=5.3; extra == "celery"
39
+ Provides-Extra: demo
40
+ Requires-Dist: flask>=2.3; extra == "demo"
41
+ Requires-Dist: sqlalchemy>=2.0; extra == "demo"
42
+ Requires-Dist: flask-sqlalchemy>=3.0; extra == "demo"
43
+ Requires-Dist: redis>=5.0; extra == "demo"
44
+ Requires-Dist: celery>=5.3; extra == "demo"
45
+ Requires-Dist: gunicorn>=21.2; extra == "demo"
46
+ Provides-Extra: dev
47
+ Requires-Dist: fastapi; extra == "dev"
48
+ Requires-Dist: uvicorn; extra == "dev"
49
+ Requires-Dist: flask; extra == "dev"
50
+ Requires-Dist: pytest; extra == "dev"
51
+
52
+ # Python Debug Agent
53
+
54
+ [![debug-agent-py](https://img.shields.io/pypi/v/debug-agent-py.svg)](https://pypi.org/project/debug-agent-py/)
55
+ ![Tools](https://img.shields.io/badge/tools-51-blue)
56
+ ![Inspectors](https://img.shields.io/badge/inspectors-16-green)
57
+
58
+ An AI-powered runtime debugging agent that embeds directly into your Python web application. Add one dependency, configure an LLM key, and chat with your live app at `/agent` to inspect memory, threads, GC, modules, database connections, Redis, Django models/URLs, Celery tasks, Flask extensions, Jinja2 templates, signals, routes, HTTP requests, and more — **51 diagnostic tools across 16 inspectors**.
59
+
60
+ ## Quick Start
61
+
62
+ ### 1. Install
63
+
64
+ ```bash
65
+ pip install debug-agent-py
66
+ ```
67
+
68
+ ### 2. Integrate (Flask)
69
+
70
+ ```python
71
+ from flask import Flask
72
+ from debug_agent import setup_debug_agent
73
+
74
+ app = Flask(__name__)
75
+
76
+ # One line to integrate
77
+ setup_debug_agent(app)
78
+ ```
79
+
80
+ ### 3. Configure LLM
81
+
82
+ ```bash
83
+ export LLM_API_KEY=your-key
84
+ export LLM_BASE_URL=https://open.bigmodel.cn/api/coding/paas/v4 # default
85
+ export LLM_MODEL=glm-5.2 # default
86
+ ```
87
+
88
+ Supports any OpenAI-compatible endpoint.
89
+
90
+ ### 4. Run and open
91
+
92
+ ```
93
+ http://localhost:8000/agent
94
+ ```
95
+
96
+ ## Features
97
+
98
+ - **Streaming AI responses** with real-time tool call badges (pending / success / error)
99
+ - **Context compression** — automatically summarizes old conversation when token limit is approached
100
+ - **Dark-themed chat UI** with full markdown rendering (tables, code blocks, lists)
101
+ - **Max tool rounds** (25) with forced final summary when limit is reached
102
+ - **51 diagnostic tools** across **16 inspectors**
103
+ - Works with Flask, FastAPI, and Django
104
+ - Zero external dependencies (no Datadog, no Grafana, no APM)
105
+
106
+ ## Inspectors & Tools (51)
107
+
108
+ ### Memory Inspector
109
+ | Tool | Description |
110
+ |------|-------------|
111
+ | `get_tracemalloc_stats` | Python tracemalloc top allocations by file/line |
112
+ | `get_object_counts` | Count objects by type via gc |
113
+ | `get_gc_stats` | gc.get_stats() generation details |
114
+ | `get_ref_cycles` | Count reference cycles detected by gc |
115
+ | `trigger_gc` | Force garbage collection |
116
+
117
+ ### Threads Inspector
118
+ | Tool | Description |
119
+ |------|-------------|
120
+ | `get_thread_info` | List all threads with name, daemon, alive status |
121
+ | `get_thread_count` | Active thread count |
122
+ | `get_thread_summary` | Thread state distribution |
123
+ | `get_thread_stacks` | Current frame/stack for all threads |
124
+
125
+ ### Database Inspector
126
+ | Tool | Description |
127
+ |------|-------------|
128
+ | `get_sqlalchemy_engines` | Find SQLAlchemy engines and pool status |
129
+ | `get_db_connections` | Inspect database connection pools |
130
+ | `get_db_pool_config` | Pool configuration: size, timeout, recycle settings |
131
+
132
+ ### Modules Inspector
133
+ | Tool | Description |
134
+ |------|-------------|
135
+ | `get_loaded_modules` | List loaded Python modules (sys.modules) with versions |
136
+ | `get_module_count` | Total loaded module count |
137
+ | `get_installed_packages` | List installed packages from pip |
138
+
139
+ ### Async Tasks Inspector
140
+ | Tool | Description |
141
+ |------|-------------|
142
+ | `get_async_tasks` | List pending asyncio tasks |
143
+ | `get_event_loop_info` | Event loop details: type, running state |
144
+ | `get_pending_callbacks` | List scheduled callbacks on the event loop |
145
+
146
+ ### Runtime Inspector
147
+ | Tool | Description |
148
+ |------|-------------|
149
+ | `get_memory_info` | Process memory info (RSS, VMS, shared) |
150
+ | `get_cpu_usage` | CPU usage percentage |
151
+ | `get_python_info` | Python version, implementation, executable path |
152
+ | `get_open_fds` | Open file descriptor count and limits |
153
+
154
+ ### System Inspector
155
+ | Tool | Description |
156
+ |------|-------------|
157
+ | `get_system_info` | Hostname, platform, CPU cores, disk |
158
+ | `get_environment_variables` | Environment variables (masked secrets) |
159
+ | `get_disk_usage` | Disk usage for the working directory |
160
+
161
+ ### Framework Inspector
162
+ | Tool | Description |
163
+ |------|-------------|
164
+ | `get_routes` | List all registered web routes/endpoints |
165
+ | `get_middleware` | List registered middleware |
166
+
167
+ ### HTTP Tracker Inspector
168
+ | Tool | Description |
169
+ |------|-------------|
170
+ | `get_recent_requests` | Recent HTTP requests ring buffer |
171
+ | `get_slow_requests` | Slowest requests by duration |
172
+ | `get_error_requests` | Error requests (4xx/5xx) |
173
+ | `get_request_stats` | P50/P95/P99 latency, error rate |
174
+
175
+ ### Redis Inspector
176
+ | Tool | Description |
177
+ |------|-------------|
178
+ | `get_redis_info` | Redis server info: memory, clients, persistence |
179
+ | `get_redis_keys` | Scan Redis keyspace with pattern matching |
180
+ | `get_redis_config` | Redis runtime configuration (CONFIG GET) |
181
+ | `get_redis_slowlog` | Redis slow query log entries |
182
+
183
+ ### Django Inspector
184
+ | Tool | Description |
185
+ |------|-------------|
186
+ | `get_django_models` | List Django models with app label, table name, field count |
187
+ | `get_django_urls` | List all URL patterns with view names and namespaces |
188
+ | `get_django_settings` | Key Django settings (DBs, INSTALLED_APPS, MIDDLEWARE) |
189
+ | `get_django_migrations` | Migration status per app: applied vs pending |
190
+
191
+ ### Celery Inspector
192
+ | Tool | Description |
193
+ |------|-------------|
194
+ | `get_celery_tasks` | List registered Celery tasks with routing info |
195
+ | `get_celery_workers` | Active Celery workers with pool and concurrency |
196
+ | `get_celery_queues` | Queue depth and message stats per queue |
197
+
198
+ ### Flask Extensions Inspector
199
+ | Tool | Description |
200
+ |------|-------------|
201
+ | `get_flask_extensions` | List registered Flask extensions and their bindings |
202
+ | `get_flask_blueprints` | List Flask blueprints with URL prefixes and routes |
203
+ | `get_flask_config` | Flask configuration object values (secrets masked) |
204
+
205
+ ### Jinja2 Inspector
206
+ | Tool | Description |
207
+ |------|-------------|
208
+ | `get_jinja_templates` | List loaded Jinja2 templates with loader paths |
209
+ | `get_jinja_filters` | List registered Jinja2 filters, tests, and globals |
210
+
211
+ ### Signals Inspector
212
+ | Tool | Description |
213
+ |------|-------------|
214
+ | `get_signal_handlers` | List Python signal handlers registered via signal module |
215
+ | `get_django_signals` | List Django signal receivers connected to senders |
216
+
217
+ ### WSGI/ASGI Inspector
218
+ | Tool | Description |
219
+ |------|-------------|
220
+ | `get_wsgi_info` | WSGI server details (Gunicorn/uWSGI workers, config) |
221
+ | `get_asgi_apps` | List ASGI application scope and middleware chain |
222
+
223
+ ## Custom Tools
224
+
225
+ ```python
226
+ from debug_agent import debug_tool
227
+
228
+ @debug_tool('check_redis', 'Check Redis connection')
229
+ def check_redis():
230
+ return {'connected': True}
231
+ ```
232
+
233
+ ## Configuration
234
+
235
+ | Env Var | Default | Description |
236
+ |---------|---------|-------------|
237
+ | `LLM_BASE_URL` | `https://open.bigmodel.cn/api/coding/paas/v4` | LLM endpoint |
238
+ | `LLM_API_KEY` | (required) | API key |
239
+ | `LLM_MODEL` | `glm-5.2` | Model name |
240
+ | `LLM_MAX_TOOL_ROUNDS` | `25` | Max tool-calling rounds |
241
+ | `LLM_CONTEXT_WINDOW_TOKENS` | `100000` | Context window size |
242
+
243
+ ## Run the Demo
244
+
245
+ The demo uses **Flask** + **redis-py** + **SQLAlchemy** + **Celery**. Start Redis with Docker Compose first:
246
+
247
+ ### Docker Compose
248
+
249
+ ```yaml
250
+ # docker-compose.yml
251
+ services:
252
+ redis:
253
+ image: redis:7-alpine
254
+ ports:
255
+ - "6379:6379"
256
+ command: redis-server --save 60 1 --loglevel warning
257
+ ```
258
+
259
+ ```bash
260
+ docker compose up -d
261
+ ```
262
+
263
+ ### Start the app
264
+
265
+ ```bash
266
+ export LLM_API_KEY=your-key
267
+ cd demo && python app.py
268
+ # Open http://localhost:8000/agent
269
+ ```
270
+
271
+ ## PyPI
272
+
273
+ [![debug-agent-py](https://img.shields.io/pypi/v/debug-agent-py.svg)](https://pypi.org/project/debug-agent-py/)
274
+
275
+ ## License
276
+
277
+ MIT
@@ -0,0 +1,226 @@
1
+ # Python Debug Agent
2
+
3
+ [![debug-agent-py](https://img.shields.io/pypi/v/debug-agent-py.svg)](https://pypi.org/project/debug-agent-py/)
4
+ ![Tools](https://img.shields.io/badge/tools-51-blue)
5
+ ![Inspectors](https://img.shields.io/badge/inspectors-16-green)
6
+
7
+ An AI-powered runtime debugging agent that embeds directly into your Python web application. Add one dependency, configure an LLM key, and chat with your live app at `/agent` to inspect memory, threads, GC, modules, database connections, Redis, Django models/URLs, Celery tasks, Flask extensions, Jinja2 templates, signals, routes, HTTP requests, and more — **51 diagnostic tools across 16 inspectors**.
8
+
9
+ ## Quick Start
10
+
11
+ ### 1. Install
12
+
13
+ ```bash
14
+ pip install debug-agent-py
15
+ ```
16
+
17
+ ### 2. Integrate (Flask)
18
+
19
+ ```python
20
+ from flask import Flask
21
+ from debug_agent import setup_debug_agent
22
+
23
+ app = Flask(__name__)
24
+
25
+ # One line to integrate
26
+ setup_debug_agent(app)
27
+ ```
28
+
29
+ ### 3. Configure LLM
30
+
31
+ ```bash
32
+ export LLM_API_KEY=your-key
33
+ export LLM_BASE_URL=https://open.bigmodel.cn/api/coding/paas/v4 # default
34
+ export LLM_MODEL=glm-5.2 # default
35
+ ```
36
+
37
+ Supports any OpenAI-compatible endpoint.
38
+
39
+ ### 4. Run and open
40
+
41
+ ```
42
+ http://localhost:8000/agent
43
+ ```
44
+
45
+ ## Features
46
+
47
+ - **Streaming AI responses** with real-time tool call badges (pending / success / error)
48
+ - **Context compression** — automatically summarizes old conversation when token limit is approached
49
+ - **Dark-themed chat UI** with full markdown rendering (tables, code blocks, lists)
50
+ - **Max tool rounds** (25) with forced final summary when limit is reached
51
+ - **51 diagnostic tools** across **16 inspectors**
52
+ - Works with Flask, FastAPI, and Django
53
+ - Zero external dependencies (no Datadog, no Grafana, no APM)
54
+
55
+ ## Inspectors & Tools (51)
56
+
57
+ ### Memory Inspector
58
+ | Tool | Description |
59
+ |------|-------------|
60
+ | `get_tracemalloc_stats` | Python tracemalloc top allocations by file/line |
61
+ | `get_object_counts` | Count objects by type via gc |
62
+ | `get_gc_stats` | gc.get_stats() generation details |
63
+ | `get_ref_cycles` | Count reference cycles detected by gc |
64
+ | `trigger_gc` | Force garbage collection |
65
+
66
+ ### Threads Inspector
67
+ | Tool | Description |
68
+ |------|-------------|
69
+ | `get_thread_info` | List all threads with name, daemon, alive status |
70
+ | `get_thread_count` | Active thread count |
71
+ | `get_thread_summary` | Thread state distribution |
72
+ | `get_thread_stacks` | Current frame/stack for all threads |
73
+
74
+ ### Database Inspector
75
+ | Tool | Description |
76
+ |------|-------------|
77
+ | `get_sqlalchemy_engines` | Find SQLAlchemy engines and pool status |
78
+ | `get_db_connections` | Inspect database connection pools |
79
+ | `get_db_pool_config` | Pool configuration: size, timeout, recycle settings |
80
+
81
+ ### Modules Inspector
82
+ | Tool | Description |
83
+ |------|-------------|
84
+ | `get_loaded_modules` | List loaded Python modules (sys.modules) with versions |
85
+ | `get_module_count` | Total loaded module count |
86
+ | `get_installed_packages` | List installed packages from pip |
87
+
88
+ ### Async Tasks Inspector
89
+ | Tool | Description |
90
+ |------|-------------|
91
+ | `get_async_tasks` | List pending asyncio tasks |
92
+ | `get_event_loop_info` | Event loop details: type, running state |
93
+ | `get_pending_callbacks` | List scheduled callbacks on the event loop |
94
+
95
+ ### Runtime Inspector
96
+ | Tool | Description |
97
+ |------|-------------|
98
+ | `get_memory_info` | Process memory info (RSS, VMS, shared) |
99
+ | `get_cpu_usage` | CPU usage percentage |
100
+ | `get_python_info` | Python version, implementation, executable path |
101
+ | `get_open_fds` | Open file descriptor count and limits |
102
+
103
+ ### System Inspector
104
+ | Tool | Description |
105
+ |------|-------------|
106
+ | `get_system_info` | Hostname, platform, CPU cores, disk |
107
+ | `get_environment_variables` | Environment variables (masked secrets) |
108
+ | `get_disk_usage` | Disk usage for the working directory |
109
+
110
+ ### Framework Inspector
111
+ | Tool | Description |
112
+ |------|-------------|
113
+ | `get_routes` | List all registered web routes/endpoints |
114
+ | `get_middleware` | List registered middleware |
115
+
116
+ ### HTTP Tracker Inspector
117
+ | Tool | Description |
118
+ |------|-------------|
119
+ | `get_recent_requests` | Recent HTTP requests ring buffer |
120
+ | `get_slow_requests` | Slowest requests by duration |
121
+ | `get_error_requests` | Error requests (4xx/5xx) |
122
+ | `get_request_stats` | P50/P95/P99 latency, error rate |
123
+
124
+ ### Redis Inspector
125
+ | Tool | Description |
126
+ |------|-------------|
127
+ | `get_redis_info` | Redis server info: memory, clients, persistence |
128
+ | `get_redis_keys` | Scan Redis keyspace with pattern matching |
129
+ | `get_redis_config` | Redis runtime configuration (CONFIG GET) |
130
+ | `get_redis_slowlog` | Redis slow query log entries |
131
+
132
+ ### Django Inspector
133
+ | Tool | Description |
134
+ |------|-------------|
135
+ | `get_django_models` | List Django models with app label, table name, field count |
136
+ | `get_django_urls` | List all URL patterns with view names and namespaces |
137
+ | `get_django_settings` | Key Django settings (DBs, INSTALLED_APPS, MIDDLEWARE) |
138
+ | `get_django_migrations` | Migration status per app: applied vs pending |
139
+
140
+ ### Celery Inspector
141
+ | Tool | Description |
142
+ |------|-------------|
143
+ | `get_celery_tasks` | List registered Celery tasks with routing info |
144
+ | `get_celery_workers` | Active Celery workers with pool and concurrency |
145
+ | `get_celery_queues` | Queue depth and message stats per queue |
146
+
147
+ ### Flask Extensions Inspector
148
+ | Tool | Description |
149
+ |------|-------------|
150
+ | `get_flask_extensions` | List registered Flask extensions and their bindings |
151
+ | `get_flask_blueprints` | List Flask blueprints with URL prefixes and routes |
152
+ | `get_flask_config` | Flask configuration object values (secrets masked) |
153
+
154
+ ### Jinja2 Inspector
155
+ | Tool | Description |
156
+ |------|-------------|
157
+ | `get_jinja_templates` | List loaded Jinja2 templates with loader paths |
158
+ | `get_jinja_filters` | List registered Jinja2 filters, tests, and globals |
159
+
160
+ ### Signals Inspector
161
+ | Tool | Description |
162
+ |------|-------------|
163
+ | `get_signal_handlers` | List Python signal handlers registered via signal module |
164
+ | `get_django_signals` | List Django signal receivers connected to senders |
165
+
166
+ ### WSGI/ASGI Inspector
167
+ | Tool | Description |
168
+ |------|-------------|
169
+ | `get_wsgi_info` | WSGI server details (Gunicorn/uWSGI workers, config) |
170
+ | `get_asgi_apps` | List ASGI application scope and middleware chain |
171
+
172
+ ## Custom Tools
173
+
174
+ ```python
175
+ from debug_agent import debug_tool
176
+
177
+ @debug_tool('check_redis', 'Check Redis connection')
178
+ def check_redis():
179
+ return {'connected': True}
180
+ ```
181
+
182
+ ## Configuration
183
+
184
+ | Env Var | Default | Description |
185
+ |---------|---------|-------------|
186
+ | `LLM_BASE_URL` | `https://open.bigmodel.cn/api/coding/paas/v4` | LLM endpoint |
187
+ | `LLM_API_KEY` | (required) | API key |
188
+ | `LLM_MODEL` | `glm-5.2` | Model name |
189
+ | `LLM_MAX_TOOL_ROUNDS` | `25` | Max tool-calling rounds |
190
+ | `LLM_CONTEXT_WINDOW_TOKENS` | `100000` | Context window size |
191
+
192
+ ## Run the Demo
193
+
194
+ The demo uses **Flask** + **redis-py** + **SQLAlchemy** + **Celery**. Start Redis with Docker Compose first:
195
+
196
+ ### Docker Compose
197
+
198
+ ```yaml
199
+ # docker-compose.yml
200
+ services:
201
+ redis:
202
+ image: redis:7-alpine
203
+ ports:
204
+ - "6379:6379"
205
+ command: redis-server --save 60 1 --loglevel warning
206
+ ```
207
+
208
+ ```bash
209
+ docker compose up -d
210
+ ```
211
+
212
+ ### Start the app
213
+
214
+ ```bash
215
+ export LLM_API_KEY=your-key
216
+ cd demo && python app.py
217
+ # Open http://localhost:8000/agent
218
+ ```
219
+
220
+ ## PyPI
221
+
222
+ [![debug-agent-py](https://img.shields.io/pypi/v/debug-agent-py.svg)](https://pypi.org/project/debug-agent-py/)
223
+
224
+ ## License
225
+
226
+ MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "debug-agent-py"
7
- version = "0.2.1"
7
+ version = "0.3.0"
8
8
  description = "AI-powered runtime debugging agent for Python web applications"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -33,6 +33,10 @@ dependencies = [
33
33
  fastapi = ["fastapi>=0.100", "starlette>=0.27", "uvicorn>=0.23"]
34
34
  flask = ["flask>=2.3"]
35
35
  django = ["django>=4.2"]
36
+ sqlalchemy = ["sqlalchemy>=2.0", "flask-sqlalchemy>=3.0"]
37
+ redis = ["redis>=5.0"]
38
+ celery = ["celery>=5.3"]
39
+ demo = ["flask>=2.3", "sqlalchemy>=2.0", "flask-sqlalchemy>=3.0", "redis>=5.0", "celery>=5.3", "gunicorn>=21.2"]
36
40
  dev = ["fastapi", "uvicorn", "flask", "pytest"]
37
41
 
38
42
  [project.urls]
@@ -2,12 +2,18 @@
2
2
 
3
3
  from debug_agent.inspectors import ( # noqa: F401
4
4
  async_tasks,
5
+ celery,
5
6
  database,
7
+ django,
8
+ flask_ext,
6
9
  framework,
7
10
  http_tracker,
11
+ jinja2,
8
12
  memory,
9
13
  modules,
14
+ redis,
10
15
  runtime,
16
+ signals,
11
17
  system,
12
18
  threads,
13
19
  )