ghost-tracer 0.1.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.
@@ -0,0 +1,45 @@
1
+ Metadata-Version: 2.4
2
+ Name: ghost-tracer
3
+ Version: 0.1.0
4
+ Summary: Professional observability for your AI agent. Trace every tool call locally.
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: cyclopts>=4
8
+ Requires-Dist: rich>=15
9
+
10
+ # Ghost Trace
11
+
12
+ Professional observability for your AI agent.
13
+
14
+ Ghost Trace is a lightweight, local-first CLI that intercepts your agent's tool calls and logs them to a SQLite database. No cloud accounts, no API keys, no heavy infrastructure. Just a beautiful trace of what your agent is doing.
15
+
16
+ ## Why use it?
17
+
18
+ Debugging AI agents with print() statements is painful. When an agent fails on step 4 of a 10-step task, you need to know exactly which tool failed, what arguments it received, and how long it took.
19
+
20
+ Ghost Trace gives you a clean, color-coded table of every tool call.
21
+
22
+ ## Installation
23
+
24
+ pip install ghost-trace
25
+
26
+ ## Usage
27
+
28
+ 1. Wrap your tools:
29
+
30
+ from ghost_trace.tracer import GhostTracer
31
+ tracer = GhostTracer()
32
+
33
+ @tracer.trace
34
+ def get_weather(city: str):
35
+ return f"Sunny in {city}"
36
+
37
+ 2. View the trace:
38
+
39
+ ghost-trace view
40
+
41
+ This will print a table of all recent tool calls, including errors and execution times.
42
+
43
+ ## License
44
+
45
+ MIT
@@ -0,0 +1,36 @@
1
+ # Ghost Trace
2
+
3
+ Professional observability for your AI agent.
4
+
5
+ Ghost Trace is a lightweight, local-first CLI that intercepts your agent's tool calls and logs them to a SQLite database. No cloud accounts, no API keys, no heavy infrastructure. Just a beautiful trace of what your agent is doing.
6
+
7
+ ## Why use it?
8
+
9
+ Debugging AI agents with print() statements is painful. When an agent fails on step 4 of a 10-step task, you need to know exactly which tool failed, what arguments it received, and how long it took.
10
+
11
+ Ghost Trace gives you a clean, color-coded table of every tool call.
12
+
13
+ ## Installation
14
+
15
+ pip install ghost-trace
16
+
17
+ ## Usage
18
+
19
+ 1. Wrap your tools:
20
+
21
+ from ghost_trace.tracer import GhostTracer
22
+ tracer = GhostTracer()
23
+
24
+ @tracer.trace
25
+ def get_weather(city: str):
26
+ return f"Sunny in {city}"
27
+
28
+ 2. View the trace:
29
+
30
+ ghost-trace view
31
+
32
+ This will print a table of all recent tool calls, including errors and execution times.
33
+
34
+ ## License
35
+
36
+ MIT
@@ -0,0 +1,37 @@
1
+ import cyclopts
2
+ from rich.console import Console
3
+ from rich.table import Table
4
+ from ghost_trace.tracer import GhostTracer
5
+
6
+ app = cyclopts.App(help="Ghost Trace: Professional observability for your AI agent.")
7
+ console = Console()
8
+
9
+ @app.command
10
+ def view(limit: int = 20, db: str = "ghost_trace.db"):
11
+ """View the latest agent execution traces."""
12
+ tracer = GhostTracer(db)
13
+ traces = tracer.get_traces(limit)
14
+
15
+ if not traces:
16
+ console.print("[yellow]No traces found. Wrap your agent tools with GhostTracer.trace() first.[/yellow]")
17
+ return
18
+
19
+ table = Table(title="Ghost Agent Traces")
20
+ table.add_column("Status", style="bold")
21
+ table.add_column("Tool", style="cyan")
22
+ table.add_column("Arguments", style="magenta")
23
+ table.add_column("Result", style="green")
24
+ table.add_column("Time (s)", justify="right")
25
+
26
+ for t in traces:
27
+ status = "[red]ERROR[/red]" if t["error"] else "[green]OK[/green]"
28
+ # Truncate long strings for the table
29
+ args = (t["arguments"][:40] + "...") if len(t["arguments"]) > 40 else t["arguments"]
30
+ result = (t["result"][:40] + "...") if t["result"] and len(t["result"]) > 40 else (t["result"] or "")
31
+
32
+ table.add_row(status, t["tool_name"], args, result, f"{t['duration']:.2f}")
33
+
34
+ console.print(table)
35
+
36
+ if __name__ == "__main__":
37
+ app()
@@ -0,0 +1,51 @@
1
+ import sqlite3
2
+ import json
3
+ import time
4
+ import functools
5
+
6
+ class GhostTracer:
7
+ def __init__(self, db_path="ghost_trace.db"):
8
+ self.db_path = db_path
9
+ self._init_db()
10
+
11
+ def _init_db(self):
12
+ with sqlite3.connect(self.db_path) as conn:
13
+ conn.execute("""
14
+ CREATE TABLE IF NOT EXISTS traces (
15
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
16
+ timestamp REAL,
17
+ tool_name TEXT,
18
+ arguments TEXT,
19
+ result TEXT,
20
+ error TEXT,
21
+ duration REAL
22
+ )
23
+ """)
24
+
25
+ def trace(self, func):
26
+ @functools.wraps(func)
27
+ def wrapper(*args, **kwargs):
28
+ start = time.time()
29
+ error = None
30
+ result = None
31
+ try:
32
+ result = func(*args, **kwargs)
33
+ return result
34
+ except Exception as e:
35
+ error = str(e)
36
+ raise
37
+ finally:
38
+ duration = time.time() - start
39
+ with sqlite3.connect(self.db_path) as conn:
40
+ conn.execute(
41
+ "INSERT INTO traces (timestamp, tool_name, arguments, result, error, duration) VALUES (?, ?, ?, ?, ?, ?)",
42
+ (start, func.__name__, json.dumps(kwargs), str(result), error, duration)
43
+ )
44
+ return wrapper
45
+
46
+ def get_traces(self, limit=20):
47
+ with sqlite3.connect(self.db_path) as conn:
48
+ conn.row_factory = sqlite3.Row
49
+ return conn.execute(
50
+ "SELECT * FROM traces ORDER BY timestamp DESC LIMIT ?", (limit,)
51
+ ).fetchall()
@@ -0,0 +1,45 @@
1
+ Metadata-Version: 2.4
2
+ Name: ghost-tracer
3
+ Version: 0.1.0
4
+ Summary: Professional observability for your AI agent. Trace every tool call locally.
5
+ Requires-Python: >=3.9
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: cyclopts>=4
8
+ Requires-Dist: rich>=15
9
+
10
+ # Ghost Trace
11
+
12
+ Professional observability for your AI agent.
13
+
14
+ Ghost Trace is a lightweight, local-first CLI that intercepts your agent's tool calls and logs them to a SQLite database. No cloud accounts, no API keys, no heavy infrastructure. Just a beautiful trace of what your agent is doing.
15
+
16
+ ## Why use it?
17
+
18
+ Debugging AI agents with print() statements is painful. When an agent fails on step 4 of a 10-step task, you need to know exactly which tool failed, what arguments it received, and how long it took.
19
+
20
+ Ghost Trace gives you a clean, color-coded table of every tool call.
21
+
22
+ ## Installation
23
+
24
+ pip install ghost-trace
25
+
26
+ ## Usage
27
+
28
+ 1. Wrap your tools:
29
+
30
+ from ghost_trace.tracer import GhostTracer
31
+ tracer = GhostTracer()
32
+
33
+ @tracer.trace
34
+ def get_weather(city: str):
35
+ return f"Sunny in {city}"
36
+
37
+ 2. View the trace:
38
+
39
+ ghost-trace view
40
+
41
+ This will print a table of all recent tool calls, including errors and execution times.
42
+
43
+ ## License
44
+
45
+ MIT
@@ -0,0 +1,10 @@
1
+ README.md
2
+ pyproject.toml
3
+ ghost_trace/cli.py
4
+ ghost_trace/tracer.py
5
+ ghost_tracer.egg-info/PKG-INFO
6
+ ghost_tracer.egg-info/SOURCES.txt
7
+ ghost_tracer.egg-info/dependency_links.txt
8
+ ghost_tracer.egg-info/entry_points.txt
9
+ ghost_tracer.egg-info/requires.txt
10
+ ghost_tracer.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ ghost-trace = ghost_trace.cli:app
@@ -0,0 +1,2 @@
1
+ cyclopts>=4
2
+ rich>=15
@@ -0,0 +1 @@
1
+ ghost_trace
@@ -0,0 +1,17 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ghost-tracer"
7
+ version = "0.1.0"
8
+ description = "Professional observability for your AI agent. Trace every tool call locally."
9
+ readme = "README.md"
10
+ requires-python = ">=3.9"
11
+ dependencies = [
12
+ "cyclopts>=4",
13
+ "rich>=15",
14
+ ]
15
+
16
+ [project.scripts]
17
+ ghost-trace = "ghost_trace.cli:app"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+