langfuse-agent-cli 0.3.0__tar.gz → 0.4.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.
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/PKG-INFO +95 -39
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/README.md +93 -37
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_agent_cli.egg-info/PKG-INFO +95 -39
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_agent_cli.egg-info/SOURCES.txt +6 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/__init__.py +1 -1
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/cli.py +38 -2
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/client.py +11 -2
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/commands/auth.py +11 -2
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/commands/doctor.py +17 -3
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/commands/help_map.py +31 -1
- langfuse_agent_cli-0.4.0/langfuse_cli/commands/lifecycle.py +115 -0
- langfuse_agent_cli-0.4.0/langfuse_cli/commands/metrics.py +113 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/commands/setup.py +56 -24
- langfuse_agent_cli-0.4.0/langfuse_cli/install_info.py +88 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/pyproject.toml +1 -1
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_cli_basics.py +12 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_docs.py +6 -0
- langfuse_agent_cli-0.4.0/tests/test_install_info.py +133 -0
- langfuse_agent_cli-0.4.0/tests/test_lifecycle.py +291 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_live.py +12 -0
- langfuse_agent_cli-0.4.0/tests/test_metrics.py +271 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_output_summary.py +2 -1
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_setup.py +138 -9
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/LICENSE +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_agent_cli.egg-info/dependency_links.txt +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_agent_cli.egg-info/entry_points.txt +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_agent_cli.egg-info/requires.txt +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_agent_cli.egg-info/top_level.txt +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/__main__.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/commands/__init__.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/commands/dataset.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/commands/prompt.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/commands/score.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/commands/trace.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/config.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/formatters/__init__.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/formatters/agent.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/langfuse_cli/formatters/timeline.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/setup.cfg +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_agent_formatters.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_cli_commands.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_cli_trace.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_client.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_config.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_help.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_output_safety.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_prompt_compile.py +0 -0
- {langfuse_agent_cli-0.3.0 → langfuse_agent_cli-0.4.0}/tests/test_timeline.py +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: langfuse-agent-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: Agent-oriented CLI and skill for Langfuse traces, prompts, datasets and scores.
|
|
5
5
|
Author-email: Tarkeshwar Narayan <122815908+tns15june@users.noreply.github.com>
|
|
6
6
|
License-Expression: MIT
|
|
7
|
-
Project-URL: Homepage, https://github.
|
|
7
|
+
Project-URL: Homepage, https://tns15june.github.io/langfuse-agent-cli/
|
|
8
8
|
Project-URL: Repository, https://github.com/tns15june/langfuse-agent-cli
|
|
9
9
|
Project-URL: Issues, https://github.com/tns15june/langfuse-agent-cli/issues
|
|
10
10
|
Keywords: langfuse,llm,observability,agent,cli,skills
|
|
@@ -28,9 +28,13 @@ Dynamic: license-file
|
|
|
28
28
|
|
|
29
29
|
# langfuse-agent-cli (`lf`)
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
Ask your coding agent about your LLM app in plain English, such as "Why did my agent fail in the last
|
|
32
|
+
hour?" or "What did we spend on each model this week?", and it answers from your
|
|
33
|
+
[Langfuse](https://langfuse.com) data with `lf`. You get failing traces with their error messages, a
|
|
34
|
+
trace as a tree, conversations, cost, latency, prompts, datasets and scores. `lf` is a command-line tool
|
|
35
|
+
plus an agent skill that teaches your agent the commands.
|
|
36
|
+
|
|
37
|
+

|
|
34
38
|
|
|
35
39
|
> **Status: prototype.** Langfuse ships an official CLI,
|
|
36
40
|
> [`@langfuse/cli`](https://github.com/langfuse/langfuse-cli), which covers the whole API, and official
|
|
@@ -48,47 +52,77 @@ in one command, a trace as a tree, and an agent skill that teaches the commands.
|
|
|
48
52
|
|
|
49
53
|
## Install
|
|
50
54
|
|
|
55
|
+
### Option 1: one line (macOS and Linux)
|
|
56
|
+
|
|
51
57
|
```bash
|
|
52
|
-
|
|
53
|
-
lf setup
|
|
58
|
+
curl -fsSL https://tns15june.github.io/langfuse-agent-cli/install.sh | sh
|
|
54
59
|
```
|
|
55
60
|
|
|
56
|
-
`lf
|
|
61
|
+
It installs `lf` with uv or pipx (and installs uv first when you have neither), then runs `lf setup`.
|
|
57
62
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
version.
|
|
67
|
-
3. **Check.** It runs `lf doctor`.
|
|
63
|
+
### Option 2: with uv or pipx
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
uv tool install langfuse-agent-cli # or: pipx install langfuse-agent-cli
|
|
67
|
+
lf setup
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### Option 3: let your coding agent install it
|
|
68
71
|
|
|
69
|
-
|
|
72
|
+
Give your agent this prompt:
|
|
70
73
|
|
|
71
74
|
```text
|
|
72
|
-
Install langfuse-agent-cli
|
|
75
|
+
Install langfuse-agent-cli using https://tns15june.github.io/langfuse-agent-cli/AGENTS.md
|
|
73
76
|
```
|
|
74
77
|
|
|
75
|
-
The agent installs
|
|
76
|
-
|
|
77
|
-
which asks for the host and the keys.
|
|
78
|
+
The agent installs `lf` and runs `lf setup --yes`, which never prompts. If no credentials are
|
|
79
|
+
configured, it asks you to run `lf setup` in your own terminal, which asks for the host and the keys.
|
|
78
80
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
### What `lf setup` does
|
|
82
|
+
|
|
83
|
+
1. **Credentials.** It keeps working credentials that it finds. When no profile is saved, or the saved
|
|
84
|
+
profile's keys are rejected, it asks for the host and the keys (the secret is not echoed) and saves
|
|
85
|
+
them. It never replaces saved keys when the server is merely unreachable, and keys from `LANGFUSE_*`
|
|
86
|
+
variables, `--env-file` or key flags, which take precedence over profiles, are left for you to fix.
|
|
87
|
+
2. **Agent skill.** It installs the `langfuse-agent-cli` skill with the
|
|
88
|
+
[skills CLI](https://github.com/vercel-labs/skills), which asks which coding agents to install it for
|
|
89
|
+
when it finds more than one. The skill comes from the release tag that matches your `lf` version.
|
|
90
|
+
3. **Check.** It runs `lf doctor` and suggests questions to try.
|
|
81
91
|
|
|
82
|
-
|
|
92
|
+
It is safe to run again: steps that are already done are skipped. For a second Langfuse instance, run
|
|
93
|
+
`lf setup --profile-name staging --host https://langfuse.example.com`; the new profile becomes the
|
|
94
|
+
current one, and `lf auth switch default` switches back.
|
|
95
|
+
|
|
96
|
+
### Verify
|
|
83
97
|
|
|
84
98
|
```bash
|
|
85
|
-
|
|
86
|
-
npx skills remove --global langfuse-agent-cli
|
|
87
|
-
pipx uninstall langfuse-agent-cli
|
|
99
|
+
lf doctor
|
|
88
100
|
```
|
|
89
101
|
|
|
90
|
-
|
|
91
|
-
|
|
102
|
+
It shows where `lf` is installed and whether a newer version exists, checks the host, the keys and the
|
|
103
|
+
API, and lists where the skill is installed.
|
|
104
|
+
|
|
105
|
+
## Try it
|
|
106
|
+
|
|
107
|
+
Start a new session of your coding agent and ask, for example:
|
|
108
|
+
|
|
109
|
+
- "Why did my LLM app fail in the last hour?"
|
|
110
|
+
- "Which tool fails most often this week, and since when?"
|
|
111
|
+
- "What did we spend on each model this week?"
|
|
112
|
+
- "Which step of my agent is the slowest?"
|
|
113
|
+
- "Walk me through the conversation in session sess-42."
|
|
114
|
+
- "Which version of the welcome-bot prompt is live, and how does it read for Alice?"
|
|
115
|
+
|
|
116
|
+
More questions, with the commands your agent runs for them:
|
|
117
|
+
[Agent examples](https://github.com/tns15june/langfuse-agent-cli/blob/main/skills/langfuse-agent-cli/references/EXAMPLES.md).
|
|
118
|
+
|
|
119
|
+
## Upgrade and uninstall
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
lf upgrade # upgrades lf with uv or pipx, then installs the matching skill
|
|
123
|
+
lf uninstall --dry-run # lists the skill, the saved profiles and lf itself
|
|
124
|
+
lf uninstall # removes them after you confirm
|
|
125
|
+
```
|
|
92
126
|
|
|
93
127
|
## Credentials
|
|
94
128
|
|
|
@@ -115,8 +149,8 @@ Profiles live in `~/.config/langfuse/profiles.json`, readable only by you (mode
|
|
|
115
149
|
|
|
116
150
|
## Commands
|
|
117
151
|
|
|
118
|
-
Data commands print JSON by default and short lines with `-o text`; `doctor`, `setup`, `
|
|
119
|
-
`help-map` print text. Three options keep JSON small:
|
|
152
|
+
Data commands print JSON by default and short lines with `-o text`; `doctor`, `setup`, `upgrade`,
|
|
153
|
+
`uninstall`, `auth` and `help-map` print text. Three options keep JSON small:
|
|
120
154
|
|
|
121
155
|
- `--compact` drops null and empty fields.
|
|
122
156
|
- `--agent-fields name,level` keeps only the listed fields of each row.
|
|
@@ -139,6 +173,11 @@ lf trace session <session-id> --compact
|
|
|
139
173
|
# Recent traces, filtered
|
|
140
174
|
lf trace list --user-id user-42 --from-ts 2026-10-24T00:00:00Z --limit 20
|
|
141
175
|
|
|
176
|
+
# Cost, tokens, latency and error counts, aggregated (the last 24 hours unless --from-ts is given)
|
|
177
|
+
lf metrics --metric totalCost,totalTokens --by providedModelName --from-ts 2026-10-20T00:00:00Z
|
|
178
|
+
lf metrics --metric latency:p95 --by name --order-by p95_latency
|
|
179
|
+
lf metrics --where level=ERROR --by name --granularity hour -o text
|
|
180
|
+
|
|
142
181
|
# Prompts
|
|
143
182
|
lf prompt list -o text
|
|
144
183
|
lf prompt get support/greeter
|
|
@@ -172,6 +211,18 @@ Exit codes: `0` success, `1` API or configuration error, `2` invalid command. Th
|
|
|
172
211
|
on stderr, except that `doctor`, `setup --yes` and `auth status` print their whole report, failures
|
|
173
212
|
included, on stdout. `setup` also exits `1` when the skill was not installed.
|
|
174
213
|
|
|
214
|
+
## Troubleshooting
|
|
215
|
+
|
|
216
|
+
| What you see | What to do |
|
|
217
|
+
| --- | --- |
|
|
218
|
+
| `command not found: lf` | `lf` is in `~/.local/bin`. Run `uv tool update-shell` or `pipx ensurepath`, then open a new terminal. |
|
|
219
|
+
| `HTTP 401: Invalid credentials` | The keys do not belong to that host. Run `lf setup`; `lf doctor` shows where the keys came from. |
|
|
220
|
+
| "is a login page or proxy answering instead of Langfuse?" | The host is a company login page or proxy. Use the address of the Langfuse API. |
|
|
221
|
+
| "This server has no /api/public/v2/observations" | The server predates Langfuse v4. The trace commands need an upgraded server. |
|
|
222
|
+
| "npx not found" or "Skill not installed" | Install Node.js 22.20 or later, then run `lf setup`. |
|
|
223
|
+
| Your saved profile is ignored | `LANGFUSE_PUBLIC_KEY` or `LANGFUSE_SECRET_KEY` is set; environment variables take precedence over profiles. |
|
|
224
|
+
| "The installed skill is v0.3.0" | Run `lf setup` to install the skill that matches your `lf` version. |
|
|
225
|
+
|
|
175
226
|
## API endpoints used
|
|
176
227
|
|
|
177
228
|
| Command | Endpoint |
|
|
@@ -180,10 +231,11 @@ included, on stdout. `setup` also exits `1` when the skill was not installed.
|
|
|
180
231
|
| `trace list --status error` | `GET /api/public/v2/observations?level=ERROR`, grouped by trace |
|
|
181
232
|
| `trace get` | `GET /api/public/v2/observations?traceId=…`, all pages |
|
|
182
233
|
| `trace session` | `GET /api/public/v2/observations?sessionId=…&isRootObservation=true` |
|
|
234
|
+
| `metrics` | `GET /api/public/v2/metrics` |
|
|
183
235
|
| `prompt list`, `prompt get`, `prompt push` | `/api/public/v2/prompts` |
|
|
184
236
|
| `dataset list`, `dataset get` | `/api/public/v2/datasets`, `/api/public/dataset-items` |
|
|
185
237
|
| `score create` | `POST /api/public/scores` |
|
|
186
|
-
| `doctor` | `/api/public/health`, `/api/public/projects`, `/api/public/v2/observations?limit=1` |
|
|
238
|
+
| `doctor` | `/api/public/health`, `/api/public/projects`, `/api/public/v2/observations?limit=1`, and PyPI for the version check (`LF_NO_UPDATE_CHECK=1` turns it off) |
|
|
187
239
|
| `auth login`, `auth status` | `/api/public/projects` |
|
|
188
240
|
| `setup` | `/api/public/projects`, then the `doctor` requests |
|
|
189
241
|
|
|
@@ -206,8 +258,8 @@ python scripts/seed_langfuse.py # synthetic prompts, a dataset and traces: use
|
|
|
206
258
|
LF_LIVE=1 pytest tests/test_live.py -v
|
|
207
259
|
```
|
|
208
260
|
|
|
209
|
-
CI runs the unit tests on Python 3.10 to 3.13 and the live tests against
|
|
210
|
-
on every push and weekly.
|
|
261
|
+
CI runs the unit tests on Python 3.10 to 3.13, shellcheck on the installer, and the live tests against
|
|
262
|
+
the latest Langfuse release, on every push and weekly.
|
|
211
263
|
|
|
212
264
|
### Releasing
|
|
213
265
|
|
|
@@ -216,17 +268,21 @@ lists `publish.yml` and the GitHub environment `pypi` as its trusted publisher.
|
|
|
216
268
|
`langfuse_cli/__init__.py`, commit, then push that commit and its tag together:
|
|
217
269
|
|
|
218
270
|
```bash
|
|
219
|
-
git tag v0.
|
|
271
|
+
git tag v0.4.0 && git push --atomic origin main v0.4.0
|
|
220
272
|
```
|
|
221
273
|
|
|
222
274
|
The workflow checks that the tag matches the version, runs the tests, builds and checks the
|
|
223
275
|
distributions, installs the wheel, and uploads the wheel and the source archive. `main` should never
|
|
224
276
|
carry a version without its tag, because `lf setup` and `lf doctor` point at the skill under that tag.
|
|
225
277
|
|
|
278
|
+
## Feedback
|
|
279
|
+
|
|
280
|
+
Questions, bugs and ideas: [GitHub issues](https://github.com/tns15june/langfuse-agent-cli/issues).
|
|
281
|
+
|
|
226
282
|
## Prior art
|
|
227
283
|
|
|
228
|
-
The command map (`lf help-map`), the `--output-summary` option, `lf setup
|
|
229
|
-
follow Atlassian's
|
|
284
|
+
The command map (`lf help-map`), the `--output-summary` option, `lf setup`, the one-line installer and
|
|
285
|
+
the agent install guide follow Atlassian's
|
|
230
286
|
[Teamwork Graph CLI](https://developer.atlassian.com/platform/teamwork-graph/twg-cli/getting-started/installation/),
|
|
231
287
|
whose `--select` option does what `lf`'s `--agent-fields` does.
|
|
232
288
|
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
# langfuse-agent-cli (`lf`)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
Ask your coding agent about your LLM app in plain English, such as "Why did my agent fail in the last
|
|
4
|
+
hour?" or "What did we spend on each model this week?", and it answers from your
|
|
5
|
+
[Langfuse](https://langfuse.com) data with `lf`. You get failing traces with their error messages, a
|
|
6
|
+
trace as a tree, conversations, cost, latency, prompts, datasets and scores. `lf` is a command-line tool
|
|
7
|
+
plus an agent skill that teaches your agent the commands.
|
|
8
|
+
|
|
9
|
+

|
|
6
10
|
|
|
7
11
|
> **Status: prototype.** Langfuse ships an official CLI,
|
|
8
12
|
> [`@langfuse/cli`](https://github.com/langfuse/langfuse-cli), which covers the whole API, and official
|
|
@@ -20,47 +24,77 @@ in one command, a trace as a tree, and an agent skill that teaches the commands.
|
|
|
20
24
|
|
|
21
25
|
## Install
|
|
22
26
|
|
|
27
|
+
### Option 1: one line (macOS and Linux)
|
|
28
|
+
|
|
23
29
|
```bash
|
|
24
|
-
|
|
25
|
-
lf setup
|
|
30
|
+
curl -fsSL https://tns15june.github.io/langfuse-agent-cli/install.sh | sh
|
|
26
31
|
```
|
|
27
32
|
|
|
28
|
-
`lf
|
|
33
|
+
It installs `lf` with uv or pipx (and installs uv first when you have neither), then runs `lf setup`.
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
version.
|
|
39
|
-
3. **Check.** It runs `lf doctor`.
|
|
35
|
+
### Option 2: with uv or pipx
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
uv tool install langfuse-agent-cli # or: pipx install langfuse-agent-cli
|
|
39
|
+
lf setup
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Option 3: let your coding agent install it
|
|
40
43
|
|
|
41
|
-
|
|
44
|
+
Give your agent this prompt:
|
|
42
45
|
|
|
43
46
|
```text
|
|
44
|
-
Install langfuse-agent-cli
|
|
47
|
+
Install langfuse-agent-cli using https://tns15june.github.io/langfuse-agent-cli/AGENTS.md
|
|
45
48
|
```
|
|
46
49
|
|
|
47
|
-
The agent installs
|
|
48
|
-
|
|
49
|
-
which asks for the host and the keys.
|
|
50
|
+
The agent installs `lf` and runs `lf setup --yes`, which never prompts. If no credentials are
|
|
51
|
+
configured, it asks you to run `lf setup` in your own terminal, which asks for the host and the keys.
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
### What `lf setup` does
|
|
54
|
+
|
|
55
|
+
1. **Credentials.** It keeps working credentials that it finds. When no profile is saved, or the saved
|
|
56
|
+
profile's keys are rejected, it asks for the host and the keys (the secret is not echoed) and saves
|
|
57
|
+
them. It never replaces saved keys when the server is merely unreachable, and keys from `LANGFUSE_*`
|
|
58
|
+
variables, `--env-file` or key flags, which take precedence over profiles, are left for you to fix.
|
|
59
|
+
2. **Agent skill.** It installs the `langfuse-agent-cli` skill with the
|
|
60
|
+
[skills CLI](https://github.com/vercel-labs/skills), which asks which coding agents to install it for
|
|
61
|
+
when it finds more than one. The skill comes from the release tag that matches your `lf` version.
|
|
62
|
+
3. **Check.** It runs `lf doctor` and suggests questions to try.
|
|
53
63
|
|
|
54
|
-
|
|
64
|
+
It is safe to run again: steps that are already done are skipped. For a second Langfuse instance, run
|
|
65
|
+
`lf setup --profile-name staging --host https://langfuse.example.com`; the new profile becomes the
|
|
66
|
+
current one, and `lf auth switch default` switches back.
|
|
67
|
+
|
|
68
|
+
### Verify
|
|
55
69
|
|
|
56
70
|
```bash
|
|
57
|
-
|
|
58
|
-
npx skills remove --global langfuse-agent-cli
|
|
59
|
-
pipx uninstall langfuse-agent-cli
|
|
71
|
+
lf doctor
|
|
60
72
|
```
|
|
61
73
|
|
|
62
|
-
|
|
63
|
-
|
|
74
|
+
It shows where `lf` is installed and whether a newer version exists, checks the host, the keys and the
|
|
75
|
+
API, and lists where the skill is installed.
|
|
76
|
+
|
|
77
|
+
## Try it
|
|
78
|
+
|
|
79
|
+
Start a new session of your coding agent and ask, for example:
|
|
80
|
+
|
|
81
|
+
- "Why did my LLM app fail in the last hour?"
|
|
82
|
+
- "Which tool fails most often this week, and since when?"
|
|
83
|
+
- "What did we spend on each model this week?"
|
|
84
|
+
- "Which step of my agent is the slowest?"
|
|
85
|
+
- "Walk me through the conversation in session sess-42."
|
|
86
|
+
- "Which version of the welcome-bot prompt is live, and how does it read for Alice?"
|
|
87
|
+
|
|
88
|
+
More questions, with the commands your agent runs for them:
|
|
89
|
+
[Agent examples](https://github.com/tns15june/langfuse-agent-cli/blob/main/skills/langfuse-agent-cli/references/EXAMPLES.md).
|
|
90
|
+
|
|
91
|
+
## Upgrade and uninstall
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
lf upgrade # upgrades lf with uv or pipx, then installs the matching skill
|
|
95
|
+
lf uninstall --dry-run # lists the skill, the saved profiles and lf itself
|
|
96
|
+
lf uninstall # removes them after you confirm
|
|
97
|
+
```
|
|
64
98
|
|
|
65
99
|
## Credentials
|
|
66
100
|
|
|
@@ -87,8 +121,8 @@ Profiles live in `~/.config/langfuse/profiles.json`, readable only by you (mode
|
|
|
87
121
|
|
|
88
122
|
## Commands
|
|
89
123
|
|
|
90
|
-
Data commands print JSON by default and short lines with `-o text`; `doctor`, `setup`, `
|
|
91
|
-
`help-map` print text. Three options keep JSON small:
|
|
124
|
+
Data commands print JSON by default and short lines with `-o text`; `doctor`, `setup`, `upgrade`,
|
|
125
|
+
`uninstall`, `auth` and `help-map` print text. Three options keep JSON small:
|
|
92
126
|
|
|
93
127
|
- `--compact` drops null and empty fields.
|
|
94
128
|
- `--agent-fields name,level` keeps only the listed fields of each row.
|
|
@@ -111,6 +145,11 @@ lf trace session <session-id> --compact
|
|
|
111
145
|
# Recent traces, filtered
|
|
112
146
|
lf trace list --user-id user-42 --from-ts 2026-10-24T00:00:00Z --limit 20
|
|
113
147
|
|
|
148
|
+
# Cost, tokens, latency and error counts, aggregated (the last 24 hours unless --from-ts is given)
|
|
149
|
+
lf metrics --metric totalCost,totalTokens --by providedModelName --from-ts 2026-10-20T00:00:00Z
|
|
150
|
+
lf metrics --metric latency:p95 --by name --order-by p95_latency
|
|
151
|
+
lf metrics --where level=ERROR --by name --granularity hour -o text
|
|
152
|
+
|
|
114
153
|
# Prompts
|
|
115
154
|
lf prompt list -o text
|
|
116
155
|
lf prompt get support/greeter
|
|
@@ -144,6 +183,18 @@ Exit codes: `0` success, `1` API or configuration error, `2` invalid command. Th
|
|
|
144
183
|
on stderr, except that `doctor`, `setup --yes` and `auth status` print their whole report, failures
|
|
145
184
|
included, on stdout. `setup` also exits `1` when the skill was not installed.
|
|
146
185
|
|
|
186
|
+
## Troubleshooting
|
|
187
|
+
|
|
188
|
+
| What you see | What to do |
|
|
189
|
+
| --- | --- |
|
|
190
|
+
| `command not found: lf` | `lf` is in `~/.local/bin`. Run `uv tool update-shell` or `pipx ensurepath`, then open a new terminal. |
|
|
191
|
+
| `HTTP 401: Invalid credentials` | The keys do not belong to that host. Run `lf setup`; `lf doctor` shows where the keys came from. |
|
|
192
|
+
| "is a login page or proxy answering instead of Langfuse?" | The host is a company login page or proxy. Use the address of the Langfuse API. |
|
|
193
|
+
| "This server has no /api/public/v2/observations" | The server predates Langfuse v4. The trace commands need an upgraded server. |
|
|
194
|
+
| "npx not found" or "Skill not installed" | Install Node.js 22.20 or later, then run `lf setup`. |
|
|
195
|
+
| Your saved profile is ignored | `LANGFUSE_PUBLIC_KEY` or `LANGFUSE_SECRET_KEY` is set; environment variables take precedence over profiles. |
|
|
196
|
+
| "The installed skill is v0.3.0" | Run `lf setup` to install the skill that matches your `lf` version. |
|
|
197
|
+
|
|
147
198
|
## API endpoints used
|
|
148
199
|
|
|
149
200
|
| Command | Endpoint |
|
|
@@ -152,10 +203,11 @@ included, on stdout. `setup` also exits `1` when the skill was not installed.
|
|
|
152
203
|
| `trace list --status error` | `GET /api/public/v2/observations?level=ERROR`, grouped by trace |
|
|
153
204
|
| `trace get` | `GET /api/public/v2/observations?traceId=…`, all pages |
|
|
154
205
|
| `trace session` | `GET /api/public/v2/observations?sessionId=…&isRootObservation=true` |
|
|
206
|
+
| `metrics` | `GET /api/public/v2/metrics` |
|
|
155
207
|
| `prompt list`, `prompt get`, `prompt push` | `/api/public/v2/prompts` |
|
|
156
208
|
| `dataset list`, `dataset get` | `/api/public/v2/datasets`, `/api/public/dataset-items` |
|
|
157
209
|
| `score create` | `POST /api/public/scores` |
|
|
158
|
-
| `doctor` | `/api/public/health`, `/api/public/projects`, `/api/public/v2/observations?limit=1` |
|
|
210
|
+
| `doctor` | `/api/public/health`, `/api/public/projects`, `/api/public/v2/observations?limit=1`, and PyPI for the version check (`LF_NO_UPDATE_CHECK=1` turns it off) |
|
|
159
211
|
| `auth login`, `auth status` | `/api/public/projects` |
|
|
160
212
|
| `setup` | `/api/public/projects`, then the `doctor` requests |
|
|
161
213
|
|
|
@@ -178,8 +230,8 @@ python scripts/seed_langfuse.py # synthetic prompts, a dataset and traces: use
|
|
|
178
230
|
LF_LIVE=1 pytest tests/test_live.py -v
|
|
179
231
|
```
|
|
180
232
|
|
|
181
|
-
CI runs the unit tests on Python 3.10 to 3.13 and the live tests against
|
|
182
|
-
on every push and weekly.
|
|
233
|
+
CI runs the unit tests on Python 3.10 to 3.13, shellcheck on the installer, and the live tests against
|
|
234
|
+
the latest Langfuse release, on every push and weekly.
|
|
183
235
|
|
|
184
236
|
### Releasing
|
|
185
237
|
|
|
@@ -188,17 +240,21 @@ lists `publish.yml` and the GitHub environment `pypi` as its trusted publisher.
|
|
|
188
240
|
`langfuse_cli/__init__.py`, commit, then push that commit and its tag together:
|
|
189
241
|
|
|
190
242
|
```bash
|
|
191
|
-
git tag v0.
|
|
243
|
+
git tag v0.4.0 && git push --atomic origin main v0.4.0
|
|
192
244
|
```
|
|
193
245
|
|
|
194
246
|
The workflow checks that the tag matches the version, runs the tests, builds and checks the
|
|
195
247
|
distributions, installs the wheel, and uploads the wheel and the source archive. `main` should never
|
|
196
248
|
carry a version without its tag, because `lf setup` and `lf doctor` point at the skill under that tag.
|
|
197
249
|
|
|
250
|
+
## Feedback
|
|
251
|
+
|
|
252
|
+
Questions, bugs and ideas: [GitHub issues](https://github.com/tns15june/langfuse-agent-cli/issues).
|
|
253
|
+
|
|
198
254
|
## Prior art
|
|
199
255
|
|
|
200
|
-
The command map (`lf help-map`), the `--output-summary` option, `lf setup
|
|
201
|
-
follow Atlassian's
|
|
256
|
+
The command map (`lf help-map`), the `--output-summary` option, `lf setup`, the one-line installer and
|
|
257
|
+
the agent install guide follow Atlassian's
|
|
202
258
|
[Teamwork Graph CLI](https://developer.atlassian.com/platform/teamwork-graph/twg-cli/getting-started/installation/),
|
|
203
259
|
whose `--select` option does what `lf`'s `--agent-fields` does.
|
|
204
260
|
|