GPU profiler for AI agents optimizing inference performance
pip install graphsignal==1.1.3 Copy PIP instructions
Graphsignal is a GPU profiler for AI agents to autonomously optimize inference performance across models, engines, and GPUs. It observes an inference engine or any GPU application from a sidecar process and exposes everything it measures through a local JSON API — everything an agent needs to profile, change flags or code, and measure again.
The profiler runs entirely locally: it listens on 127.0.0.1 (unless you bind it elsewhere with --listen-host) and sends no profiling data anywhere else unless you opt into the production feedback loop.
The default way to start is to give the profiler's skill to an AI agent — the skill is self-contained, so the agent installs the profiler, runs the workload under it, and reads the results itself:
# Claude Code mkdir -p ~/.claude/skills/graphsignal && curl -fsSL \ https://raw.githubusercontent.com/graphsignal/graphsignal/main/SKILL.md \ -o ~/.claude/skills/graphsignal/SKILL.md Other agents can be pointed at SKILL.md directly.
Then ask for the outcome you want — "use graphsignal to optimize the latency of this vLLM server" — and the agent runs the loop: benchmark, profile, read the signals, change flags or code, measure again.
UV_TOOL_BIN_DIR=/usr/local/bin uv tool install 'graphsignal[cu12]' # CUDA 12.x # or UV_TOOL_BIN_DIR=/usr/local/bin uv tool install 'graphsignal[cu13]' # CUDA 13.x Or with pip:
pip install 'graphsignal[cu12]' The cu12/cu13 extras are Linux-only and only needed for GPU profiling.
Then wrap your launch command with graphsignal-run:
graphsignal-run vllm serve --port 8001 Works with any command:
graphsignal-run sglang serve --model-path --port 8000 graphsignal-run trtllm-serve --port 8000 graphsignal-run python my_app.py Options (before the command):
Engine notes: the SGLang launcher adds --enable-metrics so the Prometheus endpoint is available; the vLLM launcher removes --disable-log-stats for the same reason. Everything else on the command line is passed through unchanged.
While the workload runs, the profiler serves everything it measures at:
curl -s http://127.0.0.1:18259/signals The response contains:
null means not measured; 0 means measured zero. The endpoint lives as long as the profiled workload.
The endpoint is what closes the loop: an AI agent launches the workload under graphsignal-run, polls /signals under load, reads which kernels, transfers, or synchronization dominate, changes flags or code, and measures again. SKILL.md teaches an agent the payload semantics and how to interpret it; see the AI Optimization guide for the full workflow.
Engines that capture their decode step into a CUDA graph — vLLM, SGLang, TensorRT-LLM, llama.cpp — replay one graph per token, so by default their decode time arrives as whole replays in cuda_graphs_nanoseconds and cuda_kernels_nanoseconds holds only the eager (prefill) kernels. When the loop needs a per-kernel ranking, relaunch with --cuda-graph-trace node: the same kernels then appear in cuda_kernels_nanoseconds by symbol, cuda_graphs_nanoseconds goes empty, and the cuda_graph_trace_mode gauge records which granularity produced the payload. It needs no elevated privileges — it is an investigation mode, not a deployment default (see Overhead).
The same listener serves the metrics in the Prometheus text format, so a Prometheus server can scrape them into an existing Grafana stack:
curl -s http://127.0.0.1:18259/metrics Gauges stay gauges; counters get a _total suffix. Histograms become Prometheus histograms (_bucket{le}, _count, _sum), plus _min/_max gauges where the source keeps the extremes. Profiles become two counters with one series per frame: _total (cumulative value) and _samples_total (sample count). Kernel frames carry kernel, symbol, category, and library labels. Metric tags and the run's context tags become labels (process.pid → process_pid); the version and instance id are on the graphsignal_profiler_info gauge. A kernel leaderboard in Grafana:
topk(20, rate(cuda_kernels_nanoseconds_total[1m])) See the Prometheus Metrics guide for the scrape config, label rules, and caveats.
graphsignal-top is the same endpoint for people: a top-like terminal view of the workload, refreshed every second.
graphsignal-top Per GPU: utilization over time, memory, power, temperature, clocks, PCIe traffic, XID errors and throttling, all from the NVML (or AMD SMI) telemetry. The engine block comes from the scraped Prometheus metrics: running and waiting requests, KV-cache usage, token throughput over time, and TTFT / TPOT / end-to-end latency quantiles. Rates and the kernel ranking cover the last 5 seconds (--window). Kernels are named by a built-in taxonomy; the details view (⏎) shows the full mangled symbol, the totals since start, and the per-process split. g, m and s switch the table to CUDA graph replays, memory transfers and host synchronization.
A workload on another machine is one flag away, provided its profiler was started with --listen-host:
graphsignal-top --host gpu-box --port 18259 graphsignal-top --once prints a single frame and exits — the same view for scripts, logs, and agents that would rather read a page than a JSON payload. Colors follow NO_COLOR and --no-color.
Add probes to a library, application, or CUDA/HIP kernels — by hand, or by an AI agent instrumenting the code it is optimizing. Vendor the header (Apache-2.0, self-contained, no dependencies):
curl -fsSL https://raw.githubusercontent.com/graphsignal/graphsignal/main/include/graphsignal/probe.h -o third_party/graphsignal/probe.h --create-dirs Register instruments and record values from host code:
#include static graphsignal_probe_entry* g_batch_ns; void init() { g_batch_ns = graphsignal_probe_register( "myengine_batch_duration_nanoseconds", GRAPHSIGNAL_HISTOGRAM, NULL, NULL, 0); } void step() { uint64_t t0 = graphsignal_now_ns(); // ... work ... graphsignal_record(g_batch_ns, graphsignal_now_ns() - t0); } Profile instruments aggregate cumulative counters per named frame (up to 250 frames), like time per operation:
static graphsignal_probe_entry* g_ops; void init() { g_ops = graphsignal_probe_register( "myengine_ops_nanoseconds", GRAPHSIGNAL_PROFILE, NULL, NULL, 0); } void run_op(const char* op_name) { uint64_t t0 = graphsignal_now_ns(); // ... op ... graphsignal_profile_add_by_name(g_ops, op_name, graphsignal_now_ns() - t0); } Or from inside CUDA kernels, with (HIP: ):
See the GPU Probes guide for complete instrumentation instructions.
Optionally, the profiler can upload its signals to Graphsignal, so production behavior feeds back into development: AI agents retrieve production metrics, errors, and resources from the server via the Signals API and use them to optimize the workload.
Enable it by setting an API key before launching:
export GRAPHSIGNAL_API_KEY= graphsignal-run vllm serve --port 8001 Without the key, no profiling data is ever uploaded. With it, the profiler additionally uploads new signals once per second to https://api.graphsignal.com/api/v1/ingest (override the base with GRAPHSIGNAL_API_BASE). The local /signals endpoint works the same either way.
Uploaded signals are read back with the same API key: GET /api/v1/instances lists the instances that have reported, and GET /api/v1/signals?instance_id= returns an instance's signals snapshot in the same shape as the local /signals payload. See the Signals API reference for usage.
GPU activity is collected with low-overhead CUPTI/ROCm activity APIs inside the workload process; everything else — analysis, statistics, the HTTP endpoint — runs in the sidecar profiler process. Nothing here needs root or GPU profiling privileges.
Three collection modes, in the order you should reach for them:
What each mode costs, measured, and the method behind the numbers: Profiler Overhead guide.
The profiler runs as a sidecar process and does not require root or elevated privileges. Its /signals and /metrics endpoint binds to 127.0.0.1 by default — when no listen host is specified, it is not reachable from outside the machine. Binding another host with --listen-host is an explicit opt-in that exposes the endpoint for remote access; it is read-only but unauthenticated, so restrict access at the network level.
Signals are uploaded only when GRAPHSIGNAL_API_KEY is set, and only to the server it reports to. Without the key, no profiling data ever leaves the machine. Remote commands are not possible in any configuration.
Content and sensitive information, such as prompts and completions, are not recorded.
Once per run the profiler asks api.graphsignal.com whether a newer release exists, sending its own version and nothing else; set GRAPHSIGNAL_DISABLE_VERSION_CHECK=1 to turn it off.
Inference profiler CUDA profiler GPU profiler
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
None of the files in this release were uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.




