debug-agent-py 0.2.1__tar.gz → 0.2.2__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 (33) hide show
  1. debug_agent_py-0.2.2/PKG-INFO +186 -0
  2. debug_agent_py-0.2.2/README.md +149 -0
  3. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/pyproject.toml +1 -1
  4. debug_agent_py-0.2.2/src/debug_agent_py.egg-info/PKG-INFO +186 -0
  5. debug_agent_py-0.2.1/PKG-INFO +0 -160
  6. debug_agent_py-0.2.1/README.md +0 -123
  7. debug_agent_py-0.2.1/src/debug_agent_py.egg-info/PKG-INFO +0 -160
  8. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/setup.cfg +0 -0
  9. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/__init__.py +0 -0
  10. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/chat_session.py +0 -0
  11. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/config.py +0 -0
  12. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/context_compressor.py +0 -0
  13. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/engine.py +0 -0
  14. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/inspectors/__init__.py +0 -0
  15. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/inspectors/async_tasks.py +0 -0
  16. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/inspectors/database.py +0 -0
  17. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/inspectors/framework.py +0 -0
  18. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/inspectors/http_tracker.py +0 -0
  19. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/inspectors/memory.py +0 -0
  20. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/inspectors/modules.py +0 -0
  21. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/inspectors/runtime.py +0 -0
  22. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/inspectors/system.py +0 -0
  23. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/inspectors/threads.py +0 -0
  24. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/llm_client.py +0 -0
  25. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/middleware.py +0 -0
  26. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/system_prompt_builder.py +0 -0
  27. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/tool_registry.py +0 -0
  28. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/web/__init__.py +0 -0
  29. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent/web/chat_page.py +0 -0
  30. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent_py.egg-info/SOURCES.txt +0 -0
  31. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent_py.egg-info/dependency_links.txt +0 -0
  32. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent_py.egg-info/requires.txt +0 -0
  33. {debug_agent_py-0.2.1 → debug_agent_py-0.2.2}/src/debug_agent_py.egg-info/top_level.txt +0 -0
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.4
2
+ Name: debug-agent-py
3
+ Version: 0.2.2
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: dev
33
+ Requires-Dist: fastapi; extra == "dev"
34
+ Requires-Dist: uvicorn; extra == "dev"
35
+ Requires-Dist: flask; extra == "dev"
36
+ Requires-Dist: pytest; extra == "dev"
37
+
38
+ # Python Debug Agent
39
+
40
+ 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, routes, HTTP requests, and more.
41
+
42
+ ## Quick Start
43
+
44
+ ### 1. Install
45
+
46
+ ```bash
47
+ pip install debug-agent-py
48
+ ```
49
+
50
+ ### 2. Integrate (Flask)
51
+
52
+ ```python
53
+ from flask import Flask
54
+ from debug_agent import setup_debug_agent
55
+
56
+ app = Flask(__name__)
57
+
58
+ # One line to integrate
59
+ setup_debug_agent(app)
60
+ ```
61
+
62
+ ### 3. Configure LLM
63
+
64
+ ```bash
65
+ export LLM_API_KEY=your-key
66
+ export LLM_BASE_URL=https://open.bigmodel.cn/api/coding/paas/v4 # default
67
+ export LLM_MODEL=glm-5.2 # default
68
+ ```
69
+
70
+ Supports any OpenAI-compatible endpoint.
71
+
72
+ ### 4. Run and open
73
+
74
+ ```
75
+ http://localhost:8000/agent
76
+ ```
77
+
78
+ ## Features
79
+
80
+ - **Streaming AI responses** with real-time tool call badges (pending / success / error)
81
+ - **Context compression** — automatically summarizes old conversation when token limit is approached
82
+ - **Dark-themed chat UI** with full markdown rendering (tables, code blocks, lists)
83
+ - **Max tool rounds** (25) with forced final summary when limit is reached
84
+ - **34 diagnostic tools** across 10 inspectors
85
+ - Works with Flask, FastAPI, and Django
86
+
87
+ ## Inspectors & Tools (34)
88
+
89
+ ### Memory Inspector
90
+ | Tool | Description |
91
+ |------|-------------|
92
+ | `get_tracemalloc_stats` | Python tracemalloc top allocations by file/line |
93
+ | `get_object_counts` | Count objects by type via gc |
94
+ | `get_gc_stats` | gc.get_stats() generation details |
95
+ | `get_ref_cycles` | Count reference cycles detected by gc |
96
+ | `trigger_gc` | Force garbage collection |
97
+
98
+ ### Threads Inspector
99
+ | Tool | Description |
100
+ |------|-------------|
101
+ | `get_thread_info` | List all threads with name, daemon, alive status |
102
+ | `get_thread_count` | Active thread count |
103
+ | `get_thread_summary` | Thread state distribution |
104
+
105
+ ### Database Inspector
106
+ | Tool | Description |
107
+ |------|-------------|
108
+ | `get_sqlalchemy_engines` | Find SQLAlchemy engines and pool status |
109
+ | `get_db_connections` | Inspect database connection pools |
110
+
111
+ ### Modules Inspector
112
+ | Tool | Description |
113
+ |------|-------------|
114
+ | `get_loaded_modules` | List loaded Python modules (sys.modules) with versions |
115
+ | `get_module_count` | Total loaded module count |
116
+ | `get_installed_packages` | List installed packages from pip |
117
+
118
+ ### Async Tasks Inspector
119
+ | Tool | Description |
120
+ |------|-------------|
121
+ | `get_async_tasks` | List pending asyncio tasks |
122
+ | `get_event_loop_info` | Event loop details: type, running state |
123
+
124
+ ### Runtime Inspector
125
+ | Tool | Description |
126
+ |------|-------------|
127
+ | `get_memory_info` | Process memory info (RSS, VMS, shared) |
128
+ | `get_cpu_usage` | CPU usage percentage |
129
+ | `get_python_info` | Python version, implementation, executable path |
130
+
131
+ ### System Inspector
132
+ | Tool | Description |
133
+ |------|-------------|
134
+ | `get_system_info` | Hostname, platform, CPU cores, disk |
135
+ | `get_environment_variables` | Environment variables (masked secrets) |
136
+ | `get_disk_usage` | Disk usage for working directory |
137
+
138
+ ### Framework Inspector
139
+ | Tool | Description |
140
+ |------|-------------|
141
+ | `get_routes` | List all registered web routes/endpoints |
142
+ | `get_middleware` | List registered middleware |
143
+
144
+ ### HTTP Tracker Inspector
145
+ | Tool | Description |
146
+ |------|-------------|
147
+ | `get_recent_requests` | Recent HTTP requests ring buffer |
148
+ | `get_slow_requests` | Slowest requests by duration |
149
+ | `get_error_requests` | Error requests (4xx/5xx) |
150
+ | `get_request_stats` | P50/P95/P99 latency, error rate |
151
+
152
+ ## Custom Tools
153
+
154
+ ```python
155
+ from debug_agent import debug_tool
156
+
157
+ @debug_tool('check_redis', 'Check Redis connection')
158
+ def check_redis():
159
+ return {'connected': True}
160
+ ```
161
+
162
+ ## Configuration
163
+
164
+ | Env Var | Default | Description |
165
+ |---------|---------|-------------|
166
+ | `LLM_BASE_URL` | `https://open.bigmodel.cn/api/coding/paas/v4` | LLM endpoint |
167
+ | `LLM_API_KEY` | (required) | API key |
168
+ | `LLM_MODEL` | `glm-5.2` | Model name |
169
+ | `LLM_MAX_TOOL_ROUNDS` | `25` | Max tool-calling rounds |
170
+ | `LLM_CONTEXT_WINDOW_TOKENS` | `100000` | Context window size |
171
+
172
+ ## Run the Demo
173
+
174
+ ```bash
175
+ export LLM_API_KEY=your-key
176
+ cd demo && python app.py
177
+ # Open http://localhost:8000/agent
178
+ ```
179
+
180
+ ## PyPI
181
+
182
+ [![debug-agent-py](https://img.shields.io/pypi/v/debug-agent-py.svg)](https://pypi.org/project/debug-agent-py/)
183
+
184
+ ## License
185
+
186
+ MIT
@@ -0,0 +1,149 @@
1
+ # Python Debug Agent
2
+
3
+ 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, routes, HTTP requests, and more.
4
+
5
+ ## Quick Start
6
+
7
+ ### 1. Install
8
+
9
+ ```bash
10
+ pip install debug-agent-py
11
+ ```
12
+
13
+ ### 2. Integrate (Flask)
14
+
15
+ ```python
16
+ from flask import Flask
17
+ from debug_agent import setup_debug_agent
18
+
19
+ app = Flask(__name__)
20
+
21
+ # One line to integrate
22
+ setup_debug_agent(app)
23
+ ```
24
+
25
+ ### 3. Configure LLM
26
+
27
+ ```bash
28
+ export LLM_API_KEY=your-key
29
+ export LLM_BASE_URL=https://open.bigmodel.cn/api/coding/paas/v4 # default
30
+ export LLM_MODEL=glm-5.2 # default
31
+ ```
32
+
33
+ Supports any OpenAI-compatible endpoint.
34
+
35
+ ### 4. Run and open
36
+
37
+ ```
38
+ http://localhost:8000/agent
39
+ ```
40
+
41
+ ## Features
42
+
43
+ - **Streaming AI responses** with real-time tool call badges (pending / success / error)
44
+ - **Context compression** — automatically summarizes old conversation when token limit is approached
45
+ - **Dark-themed chat UI** with full markdown rendering (tables, code blocks, lists)
46
+ - **Max tool rounds** (25) with forced final summary when limit is reached
47
+ - **34 diagnostic tools** across 10 inspectors
48
+ - Works with Flask, FastAPI, and Django
49
+
50
+ ## Inspectors & Tools (34)
51
+
52
+ ### Memory Inspector
53
+ | Tool | Description |
54
+ |------|-------------|
55
+ | `get_tracemalloc_stats` | Python tracemalloc top allocations by file/line |
56
+ | `get_object_counts` | Count objects by type via gc |
57
+ | `get_gc_stats` | gc.get_stats() generation details |
58
+ | `get_ref_cycles` | Count reference cycles detected by gc |
59
+ | `trigger_gc` | Force garbage collection |
60
+
61
+ ### Threads Inspector
62
+ | Tool | Description |
63
+ |------|-------------|
64
+ | `get_thread_info` | List all threads with name, daemon, alive status |
65
+ | `get_thread_count` | Active thread count |
66
+ | `get_thread_summary` | Thread state distribution |
67
+
68
+ ### Database Inspector
69
+ | Tool | Description |
70
+ |------|-------------|
71
+ | `get_sqlalchemy_engines` | Find SQLAlchemy engines and pool status |
72
+ | `get_db_connections` | Inspect database connection pools |
73
+
74
+ ### Modules Inspector
75
+ | Tool | Description |
76
+ |------|-------------|
77
+ | `get_loaded_modules` | List loaded Python modules (sys.modules) with versions |
78
+ | `get_module_count` | Total loaded module count |
79
+ | `get_installed_packages` | List installed packages from pip |
80
+
81
+ ### Async Tasks Inspector
82
+ | Tool | Description |
83
+ |------|-------------|
84
+ | `get_async_tasks` | List pending asyncio tasks |
85
+ | `get_event_loop_info` | Event loop details: type, running state |
86
+
87
+ ### Runtime Inspector
88
+ | Tool | Description |
89
+ |------|-------------|
90
+ | `get_memory_info` | Process memory info (RSS, VMS, shared) |
91
+ | `get_cpu_usage` | CPU usage percentage |
92
+ | `get_python_info` | Python version, implementation, executable path |
93
+
94
+ ### System Inspector
95
+ | Tool | Description |
96
+ |------|-------------|
97
+ | `get_system_info` | Hostname, platform, CPU cores, disk |
98
+ | `get_environment_variables` | Environment variables (masked secrets) |
99
+ | `get_disk_usage` | Disk usage for working directory |
100
+
101
+ ### Framework Inspector
102
+ | Tool | Description |
103
+ |------|-------------|
104
+ | `get_routes` | List all registered web routes/endpoints |
105
+ | `get_middleware` | List registered middleware |
106
+
107
+ ### HTTP Tracker Inspector
108
+ | Tool | Description |
109
+ |------|-------------|
110
+ | `get_recent_requests` | Recent HTTP requests ring buffer |
111
+ | `get_slow_requests` | Slowest requests by duration |
112
+ | `get_error_requests` | Error requests (4xx/5xx) |
113
+ | `get_request_stats` | P50/P95/P99 latency, error rate |
114
+
115
+ ## Custom Tools
116
+
117
+ ```python
118
+ from debug_agent import debug_tool
119
+
120
+ @debug_tool('check_redis', 'Check Redis connection')
121
+ def check_redis():
122
+ return {'connected': True}
123
+ ```
124
+
125
+ ## Configuration
126
+
127
+ | Env Var | Default | Description |
128
+ |---------|---------|-------------|
129
+ | `LLM_BASE_URL` | `https://open.bigmodel.cn/api/coding/paas/v4` | LLM endpoint |
130
+ | `LLM_API_KEY` | (required) | API key |
131
+ | `LLM_MODEL` | `glm-5.2` | Model name |
132
+ | `LLM_MAX_TOOL_ROUNDS` | `25` | Max tool-calling rounds |
133
+ | `LLM_CONTEXT_WINDOW_TOKENS` | `100000` | Context window size |
134
+
135
+ ## Run the Demo
136
+
137
+ ```bash
138
+ export LLM_API_KEY=your-key
139
+ cd demo && python app.py
140
+ # Open http://localhost:8000/agent
141
+ ```
142
+
143
+ ## PyPI
144
+
145
+ [![debug-agent-py](https://img.shields.io/pypi/v/debug-agent-py.svg)](https://pypi.org/project/debug-agent-py/)
146
+
147
+ ## License
148
+
149
+ 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.2.2"
8
8
  description = "AI-powered runtime debugging agent for Python web applications"
9
9
  readme = "README.md"
10
10
  license = {text = "MIT"}
@@ -0,0 +1,186 @@
1
+ Metadata-Version: 2.4
2
+ Name: debug-agent-py
3
+ Version: 0.2.2
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: dev
33
+ Requires-Dist: fastapi; extra == "dev"
34
+ Requires-Dist: uvicorn; extra == "dev"
35
+ Requires-Dist: flask; extra == "dev"
36
+ Requires-Dist: pytest; extra == "dev"
37
+
38
+ # Python Debug Agent
39
+
40
+ 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, routes, HTTP requests, and more.
41
+
42
+ ## Quick Start
43
+
44
+ ### 1. Install
45
+
46
+ ```bash
47
+ pip install debug-agent-py
48
+ ```
49
+
50
+ ### 2. Integrate (Flask)
51
+
52
+ ```python
53
+ from flask import Flask
54
+ from debug_agent import setup_debug_agent
55
+
56
+ app = Flask(__name__)
57
+
58
+ # One line to integrate
59
+ setup_debug_agent(app)
60
+ ```
61
+
62
+ ### 3. Configure LLM
63
+
64
+ ```bash
65
+ export LLM_API_KEY=your-key
66
+ export LLM_BASE_URL=https://open.bigmodel.cn/api/coding/paas/v4 # default
67
+ export LLM_MODEL=glm-5.2 # default
68
+ ```
69
+
70
+ Supports any OpenAI-compatible endpoint.
71
+
72
+ ### 4. Run and open
73
+
74
+ ```
75
+ http://localhost:8000/agent
76
+ ```
77
+
78
+ ## Features
79
+
80
+ - **Streaming AI responses** with real-time tool call badges (pending / success / error)
81
+ - **Context compression** — automatically summarizes old conversation when token limit is approached
82
+ - **Dark-themed chat UI** with full markdown rendering (tables, code blocks, lists)
83
+ - **Max tool rounds** (25) with forced final summary when limit is reached
84
+ - **34 diagnostic tools** across 10 inspectors
85
+ - Works with Flask, FastAPI, and Django
86
+
87
+ ## Inspectors & Tools (34)
88
+
89
+ ### Memory Inspector
90
+ | Tool | Description |
91
+ |------|-------------|
92
+ | `get_tracemalloc_stats` | Python tracemalloc top allocations by file/line |
93
+ | `get_object_counts` | Count objects by type via gc |
94
+ | `get_gc_stats` | gc.get_stats() generation details |
95
+ | `get_ref_cycles` | Count reference cycles detected by gc |
96
+ | `trigger_gc` | Force garbage collection |
97
+
98
+ ### Threads Inspector
99
+ | Tool | Description |
100
+ |------|-------------|
101
+ | `get_thread_info` | List all threads with name, daemon, alive status |
102
+ | `get_thread_count` | Active thread count |
103
+ | `get_thread_summary` | Thread state distribution |
104
+
105
+ ### Database Inspector
106
+ | Tool | Description |
107
+ |------|-------------|
108
+ | `get_sqlalchemy_engines` | Find SQLAlchemy engines and pool status |
109
+ | `get_db_connections` | Inspect database connection pools |
110
+
111
+ ### Modules Inspector
112
+ | Tool | Description |
113
+ |------|-------------|
114
+ | `get_loaded_modules` | List loaded Python modules (sys.modules) with versions |
115
+ | `get_module_count` | Total loaded module count |
116
+ | `get_installed_packages` | List installed packages from pip |
117
+
118
+ ### Async Tasks Inspector
119
+ | Tool | Description |
120
+ |------|-------------|
121
+ | `get_async_tasks` | List pending asyncio tasks |
122
+ | `get_event_loop_info` | Event loop details: type, running state |
123
+
124
+ ### Runtime Inspector
125
+ | Tool | Description |
126
+ |------|-------------|
127
+ | `get_memory_info` | Process memory info (RSS, VMS, shared) |
128
+ | `get_cpu_usage` | CPU usage percentage |
129
+ | `get_python_info` | Python version, implementation, executable path |
130
+
131
+ ### System Inspector
132
+ | Tool | Description |
133
+ |------|-------------|
134
+ | `get_system_info` | Hostname, platform, CPU cores, disk |
135
+ | `get_environment_variables` | Environment variables (masked secrets) |
136
+ | `get_disk_usage` | Disk usage for working directory |
137
+
138
+ ### Framework Inspector
139
+ | Tool | Description |
140
+ |------|-------------|
141
+ | `get_routes` | List all registered web routes/endpoints |
142
+ | `get_middleware` | List registered middleware |
143
+
144
+ ### HTTP Tracker Inspector
145
+ | Tool | Description |
146
+ |------|-------------|
147
+ | `get_recent_requests` | Recent HTTP requests ring buffer |
148
+ | `get_slow_requests` | Slowest requests by duration |
149
+ | `get_error_requests` | Error requests (4xx/5xx) |
150
+ | `get_request_stats` | P50/P95/P99 latency, error rate |
151
+
152
+ ## Custom Tools
153
+
154
+ ```python
155
+ from debug_agent import debug_tool
156
+
157
+ @debug_tool('check_redis', 'Check Redis connection')
158
+ def check_redis():
159
+ return {'connected': True}
160
+ ```
161
+
162
+ ## Configuration
163
+
164
+ | Env Var | Default | Description |
165
+ |---------|---------|-------------|
166
+ | `LLM_BASE_URL` | `https://open.bigmodel.cn/api/coding/paas/v4` | LLM endpoint |
167
+ | `LLM_API_KEY` | (required) | API key |
168
+ | `LLM_MODEL` | `glm-5.2` | Model name |
169
+ | `LLM_MAX_TOOL_ROUNDS` | `25` | Max tool-calling rounds |
170
+ | `LLM_CONTEXT_WINDOW_TOKENS` | `100000` | Context window size |
171
+
172
+ ## Run the Demo
173
+
174
+ ```bash
175
+ export LLM_API_KEY=your-key
176
+ cd demo && python app.py
177
+ # Open http://localhost:8000/agent
178
+ ```
179
+
180
+ ## PyPI
181
+
182
+ [![debug-agent-py](https://img.shields.io/pypi/v/debug-agent-py.svg)](https://pypi.org/project/debug-agent-py/)
183
+
184
+ ## License
185
+
186
+ MIT
@@ -1,160 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: debug-agent-py
3
- Version: 0.2.1
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: dev
33
- Requires-Dist: fastapi; extra == "dev"
34
- Requires-Dist: uvicorn; extra == "dev"
35
- Requires-Dist: flask; extra == "dev"
36
- Requires-Dist: pytest; extra == "dev"
37
-
38
- # Python Debug Agent
39
-
40
- 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, routes, HTTP requests, GC stats, and more.
41
-
42
- ## Quick Start
43
-
44
- ### 1. Install
45
-
46
- ```bash
47
- pip install debug-agent[fastapi]
48
- ```
49
-
50
- ### 2. Integrate (FastAPI)
51
-
52
- ```python
53
- from fastapi import FastAPI
54
- from debug_agent.middleware import create_fastapi_router
55
-
56
- app = FastAPI()
57
-
58
- # One line to integrate
59
- app.include_router(create_fastapi_router())
60
- ```
61
-
62
- ### 3. Configure LLM
63
-
64
- ```bash
65
- export LLM_API_KEY=your-key
66
- export LLM_BASE_URL=https://api.openai.com/v1 # optional
67
- export LLM_MODEL=gpt-4o # optional
68
- ```
69
-
70
- ### 4. Run and open
71
-
72
- ```
73
- http://localhost:8000/agent
74
- ```
75
-
76
- ## Framework Integrations
77
-
78
- ### FastAPI / Starlette
79
-
80
- ```python
81
- from debug_agent.middleware import create_fastapi_router
82
- app.include_router(create_fastapi_router())
83
- ```
84
-
85
- ### Flask
86
-
87
- ```python
88
- from flask import Flask
89
- from debug_agent.middleware import create_flask_blueprint
90
- app = Flask(__name__)
91
- app.register_blueprint(create_flask_blueprint())
92
- ```
93
-
94
- ### Any ASGI App (Starlette Mount)
95
-
96
- ```python
97
- from starlette.routing import Mount
98
- from debug_agent.middleware import create_starlette_app
99
- routes = [Mount("/agent", app=create_starlette_app())]
100
- ```
101
-
102
- ## Built-in Tools (18+)
103
-
104
- | Tool | Description |
105
- |------|-------------|
106
- | `get_gc_stats` | GC collection counts per generation |
107
- | `get_memory_summary` | RSS, object counts, top types |
108
- | `trigger_gc` | Force GC and show before/after |
109
- | `get_thread_summary` | Thread count, names, daemon status |
110
- | `get_thread_dump` | Stack traces for all threads |
111
- | `get_runtime_info` | Python version, platform, PID |
112
- | `get_memory_allocations` | tracemalloc top allocations |
113
- | `get_routes` | List all web routes/endpoints |
114
- | `get_middleware` | List registered middleware |
115
- | `get_installed_packages` | Installed pip packages |
116
- | `get_environment_variables` | Environment variables (masked secrets) |
117
- | `get_recent_requests` | HTTP request ring buffer |
118
- | `get_slow_requests` | Slowest requests sorted by duration |
119
- | `get_error_requests` | Error requests (4xx/5xx) |
120
- | `get_request_stats` | P50/P95/P99 latency, error rate |
121
- | `get_process_info` | PID, CPU time, container detection |
122
- | `get_system_info` | OS, CPU cores, load average |
123
- | `get_disk_usage` | Disk usage for working directory |
124
-
125
- ## Custom Tools
126
-
127
- ```python
128
- from debug_agent import debug_tool, ToolParam
129
-
130
- @debug_tool("check_db_pool", "Check database connection pool stats")
131
- def check_db_pool() -> dict:
132
- return {"active": 5, "idle": 10, "max": 20}
133
- ```
134
-
135
- That's it. The tool is auto-discovered and made available to the LLM.
136
-
137
- ## Configuration
138
-
139
- | Env Var | Default | Description |
140
- |---------|---------|-------------|
141
- | `DEBUG_AGENT_ENABLED` | `true` | Enable/disable |
142
- | `DEBUG_AGENT_BASE_PATH` | `/agent` | URL path |
143
- | `LLM_BASE_URL` | `https://api.openai.com/v1` | LLM endpoint |
144
- | `LLM_API_KEY` | (required) | API key |
145
- | `LLM_MODEL` | `gpt-4o` | Model name |
146
- | `LLM_TEMPERATURE` | `0.3` | Sampling temp |
147
- | `LLM_MAX_TOOL_ROUNDS` | `10` | Max tool rounds |
148
-
149
- ## Run the Demo
150
-
151
- ```bash
152
- pip install -e ".[dev]"
153
- export LLM_API_KEY=your-key
154
- python demo/app.py
155
- # Open http://localhost:8000/agent
156
- ```
157
-
158
- ## License
159
-
160
- MIT
@@ -1,123 +0,0 @@
1
- # Python Debug Agent
2
-
3
- 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, routes, HTTP requests, GC stats, and more.
4
-
5
- ## Quick Start
6
-
7
- ### 1. Install
8
-
9
- ```bash
10
- pip install debug-agent[fastapi]
11
- ```
12
-
13
- ### 2. Integrate (FastAPI)
14
-
15
- ```python
16
- from fastapi import FastAPI
17
- from debug_agent.middleware import create_fastapi_router
18
-
19
- app = FastAPI()
20
-
21
- # One line to integrate
22
- app.include_router(create_fastapi_router())
23
- ```
24
-
25
- ### 3. Configure LLM
26
-
27
- ```bash
28
- export LLM_API_KEY=your-key
29
- export LLM_BASE_URL=https://api.openai.com/v1 # optional
30
- export LLM_MODEL=gpt-4o # optional
31
- ```
32
-
33
- ### 4. Run and open
34
-
35
- ```
36
- http://localhost:8000/agent
37
- ```
38
-
39
- ## Framework Integrations
40
-
41
- ### FastAPI / Starlette
42
-
43
- ```python
44
- from debug_agent.middleware import create_fastapi_router
45
- app.include_router(create_fastapi_router())
46
- ```
47
-
48
- ### Flask
49
-
50
- ```python
51
- from flask import Flask
52
- from debug_agent.middleware import create_flask_blueprint
53
- app = Flask(__name__)
54
- app.register_blueprint(create_flask_blueprint())
55
- ```
56
-
57
- ### Any ASGI App (Starlette Mount)
58
-
59
- ```python
60
- from starlette.routing import Mount
61
- from debug_agent.middleware import create_starlette_app
62
- routes = [Mount("/agent", app=create_starlette_app())]
63
- ```
64
-
65
- ## Built-in Tools (18+)
66
-
67
- | Tool | Description |
68
- |------|-------------|
69
- | `get_gc_stats` | GC collection counts per generation |
70
- | `get_memory_summary` | RSS, object counts, top types |
71
- | `trigger_gc` | Force GC and show before/after |
72
- | `get_thread_summary` | Thread count, names, daemon status |
73
- | `get_thread_dump` | Stack traces for all threads |
74
- | `get_runtime_info` | Python version, platform, PID |
75
- | `get_memory_allocations` | tracemalloc top allocations |
76
- | `get_routes` | List all web routes/endpoints |
77
- | `get_middleware` | List registered middleware |
78
- | `get_installed_packages` | Installed pip packages |
79
- | `get_environment_variables` | Environment variables (masked secrets) |
80
- | `get_recent_requests` | HTTP request ring buffer |
81
- | `get_slow_requests` | Slowest requests sorted by duration |
82
- | `get_error_requests` | Error requests (4xx/5xx) |
83
- | `get_request_stats` | P50/P95/P99 latency, error rate |
84
- | `get_process_info` | PID, CPU time, container detection |
85
- | `get_system_info` | OS, CPU cores, load average |
86
- | `get_disk_usage` | Disk usage for working directory |
87
-
88
- ## Custom Tools
89
-
90
- ```python
91
- from debug_agent import debug_tool, ToolParam
92
-
93
- @debug_tool("check_db_pool", "Check database connection pool stats")
94
- def check_db_pool() -> dict:
95
- return {"active": 5, "idle": 10, "max": 20}
96
- ```
97
-
98
- That's it. The tool is auto-discovered and made available to the LLM.
99
-
100
- ## Configuration
101
-
102
- | Env Var | Default | Description |
103
- |---------|---------|-------------|
104
- | `DEBUG_AGENT_ENABLED` | `true` | Enable/disable |
105
- | `DEBUG_AGENT_BASE_PATH` | `/agent` | URL path |
106
- | `LLM_BASE_URL` | `https://api.openai.com/v1` | LLM endpoint |
107
- | `LLM_API_KEY` | (required) | API key |
108
- | `LLM_MODEL` | `gpt-4o` | Model name |
109
- | `LLM_TEMPERATURE` | `0.3` | Sampling temp |
110
- | `LLM_MAX_TOOL_ROUNDS` | `10` | Max tool rounds |
111
-
112
- ## Run the Demo
113
-
114
- ```bash
115
- pip install -e ".[dev]"
116
- export LLM_API_KEY=your-key
117
- python demo/app.py
118
- # Open http://localhost:8000/agent
119
- ```
120
-
121
- ## License
122
-
123
- MIT
@@ -1,160 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: debug-agent-py
3
- Version: 0.2.1
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: dev
33
- Requires-Dist: fastapi; extra == "dev"
34
- Requires-Dist: uvicorn; extra == "dev"
35
- Requires-Dist: flask; extra == "dev"
36
- Requires-Dist: pytest; extra == "dev"
37
-
38
- # Python Debug Agent
39
-
40
- 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, routes, HTTP requests, GC stats, and more.
41
-
42
- ## Quick Start
43
-
44
- ### 1. Install
45
-
46
- ```bash
47
- pip install debug-agent[fastapi]
48
- ```
49
-
50
- ### 2. Integrate (FastAPI)
51
-
52
- ```python
53
- from fastapi import FastAPI
54
- from debug_agent.middleware import create_fastapi_router
55
-
56
- app = FastAPI()
57
-
58
- # One line to integrate
59
- app.include_router(create_fastapi_router())
60
- ```
61
-
62
- ### 3. Configure LLM
63
-
64
- ```bash
65
- export LLM_API_KEY=your-key
66
- export LLM_BASE_URL=https://api.openai.com/v1 # optional
67
- export LLM_MODEL=gpt-4o # optional
68
- ```
69
-
70
- ### 4. Run and open
71
-
72
- ```
73
- http://localhost:8000/agent
74
- ```
75
-
76
- ## Framework Integrations
77
-
78
- ### FastAPI / Starlette
79
-
80
- ```python
81
- from debug_agent.middleware import create_fastapi_router
82
- app.include_router(create_fastapi_router())
83
- ```
84
-
85
- ### Flask
86
-
87
- ```python
88
- from flask import Flask
89
- from debug_agent.middleware import create_flask_blueprint
90
- app = Flask(__name__)
91
- app.register_blueprint(create_flask_blueprint())
92
- ```
93
-
94
- ### Any ASGI App (Starlette Mount)
95
-
96
- ```python
97
- from starlette.routing import Mount
98
- from debug_agent.middleware import create_starlette_app
99
- routes = [Mount("/agent", app=create_starlette_app())]
100
- ```
101
-
102
- ## Built-in Tools (18+)
103
-
104
- | Tool | Description |
105
- |------|-------------|
106
- | `get_gc_stats` | GC collection counts per generation |
107
- | `get_memory_summary` | RSS, object counts, top types |
108
- | `trigger_gc` | Force GC and show before/after |
109
- | `get_thread_summary` | Thread count, names, daemon status |
110
- | `get_thread_dump` | Stack traces for all threads |
111
- | `get_runtime_info` | Python version, platform, PID |
112
- | `get_memory_allocations` | tracemalloc top allocations |
113
- | `get_routes` | List all web routes/endpoints |
114
- | `get_middleware` | List registered middleware |
115
- | `get_installed_packages` | Installed pip packages |
116
- | `get_environment_variables` | Environment variables (masked secrets) |
117
- | `get_recent_requests` | HTTP request ring buffer |
118
- | `get_slow_requests` | Slowest requests sorted by duration |
119
- | `get_error_requests` | Error requests (4xx/5xx) |
120
- | `get_request_stats` | P50/P95/P99 latency, error rate |
121
- | `get_process_info` | PID, CPU time, container detection |
122
- | `get_system_info` | OS, CPU cores, load average |
123
- | `get_disk_usage` | Disk usage for working directory |
124
-
125
- ## Custom Tools
126
-
127
- ```python
128
- from debug_agent import debug_tool, ToolParam
129
-
130
- @debug_tool("check_db_pool", "Check database connection pool stats")
131
- def check_db_pool() -> dict:
132
- return {"active": 5, "idle": 10, "max": 20}
133
- ```
134
-
135
- That's it. The tool is auto-discovered and made available to the LLM.
136
-
137
- ## Configuration
138
-
139
- | Env Var | Default | Description |
140
- |---------|---------|-------------|
141
- | `DEBUG_AGENT_ENABLED` | `true` | Enable/disable |
142
- | `DEBUG_AGENT_BASE_PATH` | `/agent` | URL path |
143
- | `LLM_BASE_URL` | `https://api.openai.com/v1` | LLM endpoint |
144
- | `LLM_API_KEY` | (required) | API key |
145
- | `LLM_MODEL` | `gpt-4o` | Model name |
146
- | `LLM_TEMPERATURE` | `0.3` | Sampling temp |
147
- | `LLM_MAX_TOOL_ROUNDS` | `10` | Max tool rounds |
148
-
149
- ## Run the Demo
150
-
151
- ```bash
152
- pip install -e ".[dev]"
153
- export LLM_API_KEY=your-key
154
- python demo/app.py
155
- # Open http://localhost:8000/agent
156
- ```
157
-
158
- ## License
159
-
160
- MIT
File without changes