debug-agent-py 0.2.1__py3-none-any.whl

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.
@@ -0,0 +1,160 @@
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
@@ -0,0 +1,25 @@
1
+ debug_agent/__init__.py,sha256=xrPMN77ZcadWnb-_Wl52mGGb9Yp69pImU_I5I8ujxS8,1037
2
+ debug_agent/chat_session.py,sha256=W8xp6xv0QCgO-uyBiOng3lqRz93MMQuVfChLgudzgoY,1447
3
+ debug_agent/config.py,sha256=s8QMootNpvDEZXNVWwG1-9chbmrLBgdg8VWtb6h1w8o,1812
4
+ debug_agent/context_compressor.py,sha256=dqg5B0ZKvBkbceFxexGil3cP8soT0G2N6GopwdN2AdQ,5930
5
+ debug_agent/engine.py,sha256=FHyJsyixU8PeIGw_APJY-kEW9-lbBBEgXX_NpS5CxqE,7181
6
+ debug_agent/llm_client.py,sha256=5Fa0tQ4WKRSbyyL4nmi49AXWIzBFMqPY012RVxRZkG8,7058
7
+ debug_agent/middleware.py,sha256=vxmqPbUABxlvshRunI0rsAcXDRruxaSUXxD9z_C1abU,6609
8
+ debug_agent/system_prompt_builder.py,sha256=MW7reak_hpUBhvpCzhsfCJ6OjbnasiRV6gcEHJlVrPI,3760
9
+ debug_agent/tool_registry.py,sha256=7GzjxQv4MRB37q6KCaBBZp3q2lKpBGeru8ZdyVkrlDU,3423
10
+ debug_agent/inspectors/__init__.py,sha256=OeMjuhCqSYWPRzQs-kn3pzEa-U1KnWmeWbb8bUa9ckc,262
11
+ debug_agent/inspectors/async_tasks.py,sha256=qonpDa0ZXTX-rEFumkO8ivf5hZGNsAzY8LlXh-m3Eg8,2939
12
+ debug_agent/inspectors/database.py,sha256=0es21X_Zy9QD8F1GaXoTVq1CCFzmd9w3BQW7_p0fVBU,3882
13
+ debug_agent/inspectors/framework.py,sha256=PcyDFUC_qJUkGP2lrHVHB_MTi21I9TeO-U2FhMXjpr0,4591
14
+ debug_agent/inspectors/http_tracker.py,sha256=p24IstULxWqczbtpXD4Pqfb2PHXrIj-Juia4K6nt6nI,2957
15
+ debug_agent/inspectors/memory.py,sha256=BGCQVP06czts_sqX65-6mEbGmK9vSFcIkwR1FgLi3fw,3634
16
+ debug_agent/inspectors/modules.py,sha256=6anC5sZD1HruLZf20ItOd_7HhdfzXSnQj34CnFPG6p0,3920
17
+ debug_agent/inspectors/runtime.py,sha256=afIrYqxxDlIaiiLVI7voWJGsNpt4c1UM1hbP_nT-nGM,4063
18
+ debug_agent/inspectors/system.py,sha256=i9EKH6zrDoqPeLYwKaoloTkbnJsnLNojEAMp5vHFRTQ,2331
19
+ debug_agent/inspectors/threads.py,sha256=WIuV4UcNY8ZrhEl1Yfh2nIZxyFKIyN8PzonswZ88JVw,2820
20
+ debug_agent/web/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
21
+ debug_agent/web/chat_page.py,sha256=g12-zvBDcueyRBvFKFmVhfu2Q1XttkZS9Y1FpLKHSBI,21901
22
+ debug_agent_py-0.2.1.dist-info/METADATA,sha256=JkXdAjOBX0jsQGWvRJ_pTmE-UftLvgDYz5EGmDPmRzg,4875
23
+ debug_agent_py-0.2.1.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
24
+ debug_agent_py-0.2.1.dist-info/top_level.txt,sha256=S6pzX1gCx6nMIK2Gm-FXOyTk0R2Wp0GWPzkZLxoNnQg,12
25
+ debug_agent_py-0.2.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ debug_agent