dv-pipecat-flows 0.0.23.dev1__tar.gz → 0.0.23.dev3__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 (96) hide show
  1. dv_pipecat_flows-0.0.23.dev3/.agents/skills/loki-logs/SKILL.md +121 -0
  2. dv_pipecat_flows-0.0.23.dev3/.agents/skills/loki-logs/query-reference.md +113 -0
  3. dv_pipecat_flows-0.0.23.dev3/.claude/skills/loki-logs/SKILL.md +121 -0
  4. dv_pipecat_flows-0.0.23.dev3/.claude/skills/loki-logs/query-reference.md +113 -0
  5. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/.gitignore +5 -0
  6. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/AGENTS.md +50 -4
  7. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/PKG-INFO +5 -2
  8. dv_pipecat_flows-0.0.23.dev3/engine_primitives_plan.md +128 -0
  9. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/pyproject.toml +5 -2
  10. dv_pipecat_flows-0.0.23.dev3/remote-asterisk-code/README.md +0 -0
  11. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/src/dv_pipecat_flows.egg-info/PKG-INFO +5 -2
  12. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/src/dv_pipecat_flows.egg-info/SOURCES.txt +15 -2
  13. dv_pipecat_flows-0.0.23.dev3/src/dv_pipecat_flows.egg-info/requires.txt +6 -0
  14. dv_pipecat_flows-0.0.23.dev3/src/dv_pipecat_flows.egg-info/scm_file_list.json +491 -0
  15. dv_pipecat_flows-0.0.23.dev3/src/dv_pipecat_flows.egg-info/scm_version.json +8 -0
  16. dv_pipecat_flows-0.0.23.dev3/src/pipecat_flows/actions.py +750 -0
  17. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/src/pipecat_flows/adapters.py +530 -0
  18. dv_pipecat_flows-0.0.23.dev3/src/pipecat_flows/condition_evaluator.py +518 -0
  19. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/src/pipecat_flows/exceptions.py +39 -0
  20. dv_pipecat_flows-0.0.23.dev3/src/pipecat_flows/flow_validator.py +151 -0
  21. dv_pipecat_flows-0.0.23.dev3/src/pipecat_flows/manager.py +4295 -0
  22. dv_pipecat_flows-0.0.23.dev3/src/pipecat_flows/processors/__init__.py +7 -0
  23. dv_pipecat_flows-0.0.23.dev3/src/pipecat_flows/processors/router_mode_guard.py +131 -0
  24. dv_pipecat_flows-0.0.23.dev3/src/pipecat_flows/processors/speak_interruption_guard.py +84 -0
  25. dv_pipecat_flows-0.0.23.dev3/src/pipecat_flows/processors/user_turn_observer.py +138 -0
  26. dv_pipecat_flows-0.0.23.dev3/src/pipecat_flows/router_mode.py +401 -0
  27. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/src/pipecat_flows/types.py +224 -0
  28. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/uv.lock +277 -1149
  29. dv_pipecat_flows-0.0.23.dev1/remote-asterisk-code/README.md +0 -307
  30. dv_pipecat_flows-0.0.23.dev1/src/dv_pipecat_flows.egg-info/requires.txt +0 -3
  31. dv_pipecat_flows-0.0.23.dev1/src/pipecat_flows/actions.py +0 -389
  32. dv_pipecat_flows-0.0.23.dev1/src/pipecat_flows/data_extractor.py +0 -249
  33. dv_pipecat_flows-0.0.23.dev1/src/pipecat_flows/manager.py +0 -1365
  34. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/.gitattributes +0 -0
  35. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/.pre-commit-config.yaml +0 -0
  36. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/.python-version +0 -0
  37. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/.readthedocs.yaml +0 -0
  38. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/CHANGELOG.md +0 -0
  39. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/CLAUDE.md +0 -0
  40. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/CONTRIBUTING.md +0 -0
  41. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/LICENSE +0 -0
  42. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/MANIFEST.in +0 -0
  43. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/README.md +1 -1
  44. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/dev-requirements.txt +0 -0
  45. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/docker-compose.dev.yml +0 -0
  46. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/.eslintrc.json +0 -0
  47. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/.prettierrc +0 -0
  48. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/css/tailwind.css +0 -0
  49. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/examples/food_ordering.json +0 -0
  50. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/examples/movie_explorer.json +0 -0
  51. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/examples/patient_intake.json +0 -0
  52. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/examples/restaurant_reservation.json +0 -0
  53. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/examples/travel_planner.json +0 -0
  54. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/favicon.png +0 -0
  55. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/favicon.svg +0 -0
  56. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/index.html +0 -0
  57. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/editor/canvas.js +0 -0
  58. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/editor/editorState.js +0 -0
  59. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/editor/sidePanel.js +0 -0
  60. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/editor/toolbar.js +0 -0
  61. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/main.js +0 -0
  62. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/nodes/baseNode.js +0 -0
  63. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/nodes/endNode.js +0 -0
  64. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/nodes/flowNode.js +0 -0
  65. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/nodes/functionNode.js +0 -0
  66. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/nodes/index.js +0 -0
  67. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/nodes/mergeNode.js +0 -0
  68. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/nodes/startNode.js +0 -0
  69. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/types.js +0 -0
  70. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/utils/export.js +0 -0
  71. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/utils/helpers.js +0 -0
  72. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/utils/import.js +0 -0
  73. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/js/utils/validation.js +0 -0
  74. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/jsdoc.json +0 -0
  75. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/package-lock.json +0 -0
  76. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/package.json +0 -0
  77. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/postcss.config.cjs +0 -0
  78. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/public/favicon.png +0 -0
  79. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/public/favicon.svg +0 -0
  80. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/tailwind.config.cjs +0 -0
  81. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/vercel.json +0 -0
  82. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/editor/vite.config.js +0 -0
  83. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/env.example +0 -0
  84. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/images/food-ordering-flow.png +0 -0
  85. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/pipecat-flows.png +0 -0
  86. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/pipecat_upgrade.md +0 -0
  87. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/remote-asterisk-code/extensions.conf +0 -0
  88. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/remote-asterisk-code/rtp.conf +0 -0
  89. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/requirements.txt +0 -0
  90. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/scripts/check-pypi-package.py +0 -0
  91. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/scripts/fix-ruff.sh +0 -0
  92. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/scripts/pre-commit.sh +0 -0
  93. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/setup.cfg +0 -0
  94. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/src/dv_pipecat_flows.egg-info/dependency_links.txt +0 -0
  95. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/src/dv_pipecat_flows.egg-info/top_level.txt +0 -0
  96. {dv_pipecat_flows-0.0.23.dev1 → dv_pipecat_flows-0.0.23.dev3}/src/pipecat_flows/__init__.py +0 -0
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: loki-logs
3
+ description: Fetch and analyze pipecat application logs from Loki by call ID or call SID. Use when debugging call issues, investigating errors, or analyzing bot behavior for a specific call. Accepts a call_id (UUID) or call_sid (numeric string like 3341710001) and optional environment (staging/production).
4
+ argument-hint: <call_id|call_sid> [staging|production]
5
+ allowed-tools: Bash(curl *), Bash(jq *)
6
+ ---
7
+
8
+ # Loki Logs Fetcher
9
+
10
+ Fetch logs from Loki for a specific pipecat call and analyze them.
11
+
12
+ ## Parameters
13
+
14
+ - `$0` — **call_id or call_sid** (required): Either a UUID (e.g. `f3df923e-d535-4eff-a3c8-fefbae0e73bf`) or a numeric call SID string (e.g. `3341710001`)
15
+ - `$1` — **environment** (optional): `production` (default) or `staging`
16
+
17
+ ## Instructions
18
+
19
+ When invoked, follow these steps:
20
+
21
+ ### 1. Parse arguments
22
+
23
+ ```
24
+ IDENTIFIER = $0
25
+ ENV = $1 (default: "production")
26
+ ```
27
+
28
+ If `ENV` is `prod`, normalize it to `production`.
29
+ If `IDENTIFIER` is missing, ask the user for it.
30
+
31
+ Detect the identifier type:
32
+ - **UUID format** (contains hyphens, hex chars, e.g. `f3df923e-d535-...`): This is a `call_id`
33
+ - **Numeric string** (digits only, e.g. `3341710001`): This is a `call_sid`
34
+
35
+ Both work the same way in the Loki query — they are used as a substring match (`|=`) against the log lines.
36
+
37
+ ### 2. Fetch logs from Loki
38
+
39
+ Use the Loki HTTP API at `http://35.154.72.110:3100` to query logs.
40
+
41
+ The LogQL query to use:
42
+
43
+ ```
44
+ {application="pipecat", environment="<ENV>"} |= `<IDENTIFIER>` | json | level=~"(?i)DEBUG|INFO|WARNING|ERROR|FATAL" | line_format `{{.message}}`
45
+ ```
46
+
47
+ Execute this curl command (default time range: last 24 hours):
48
+
49
+ **Timezone note:** If the user provides a specific time or time range, treat it as **IST (Asia/Kolkata, UTC+5:30)**. Convert to UTC epoch before querying Loki.
50
+
51
+ ```bash
52
+ # Calculate timestamps (nanoseconds) — default: last 24 hours
53
+ END=$(date +%s)000000000
54
+ START=$(( $(date +%s) - 86400 ))000000000
55
+
56
+ curl -s "http://35.154.72.110:3100/loki/api/v1/query_range" \
57
+ --data-urlencode "query={application=\"pipecat\", environment=\"<ENV>\"} |= \`<IDENTIFIER>\` | json | level=~\"(?i)DEBUG|INFO|WARNING|ERROR|FATAL\" | line_format \`{{.message}}\`" \
58
+ --data-urlencode "start=$START" \
59
+ --data-urlencode "end=$END" \
60
+ --data-urlencode "limit=5000" \
61
+ --data-urlencode "direction=forward" | jq .
62
+ ```
63
+
64
+ If the result set is empty and the environment was `production`, suggest trying `staging` (and vice versa).
65
+
66
+ If the result set is empty for both, try expanding the time range to 48 hours.
67
+
68
+ ### 3. Parse and display the logs
69
+
70
+ Extract the log lines from the Loki JSON response. The response structure is:
71
+
72
+ ```json
73
+ {
74
+ "data": {
75
+ "result": [
76
+ {
77
+ "values": [
78
+ ["<timestamp_ns>", "<log_line>"]
79
+ ]
80
+ }
81
+ ]
82
+ }
83
+ }
84
+ ```
85
+
86
+ Display the logs in chronological order (earliest first). Show:
87
+ - Timestamp (human-readable)
88
+ - Log level (if parseable)
89
+ - Message content
90
+
91
+ ### 4. Analyze the logs
92
+
93
+ After displaying the logs, provide a brief analysis:
94
+
95
+ 1. **Call timeline**: What happened during this call? (connected, greeted, conversation flow, ended)
96
+ 2. **Errors/warnings**: Highlight any ERROR or WARNING level logs
97
+ 3. **Tool calls**: List any function/tool calls made during the call
98
+ 4. **TTS/STT activity**: Note any speech-related events
99
+ 5. **Call outcome**: How did the call end? (normal hangup, error, transfer, timeout)
100
+ 6. **Anomalies**: Flag anything unusual (long silences, repeated errors, unexpected state transitions)
101
+
102
+ ### 5. Grafana link
103
+
104
+ Always provide a clickable Grafana Explore link for the user to view the logs in the browser:
105
+
106
+ ```
107
+ http://35.154.72.110:3000/explore?schemaVersion=1&panes=%7B%221f1%22%3A%7B%22datasource%22%3A%22eeey6hiactdz4c%22%2C%22queries%22%3A%5B%7B%22datasource%22%3A%7B%22type%22%3A%22loki%22%2C%22uid%22%3A%22eeey6hiactdz4c%22%7D%2C%22direction%22%3A%22backward%22%2C%22editorMode%22%3A%22code%22%2C%22expr%22%3A%22%7Bapplication%3D%5C%22pipecat%5C%22%2C+environment%3D%5C%22<ENV>%5C%22%7D+%7C%3D+%60<IDENTIFIER>%60+%7C+json+%7C+level%3D%7E%5C%22%28%3Fi%29DEBUG%7CINFO%7CWARNING%7CERROR%7C+FATAL%5C%22+%7C+line_format+%60%7B%7B.message%7D%7D%60%22%2C%22queryType%22%3A%22range%22%2C%22refId%22%3A%22A%22%7D%5D%2C%22range%22%3A%7B%22from%22%3A%22now-6h%22%2C%22to%22%3A%22now%22%7D%2C%22compact%22%3Afalse%7D%7D&orgId=1
108
+ ```
109
+
110
+ Replace `<ENV>` and `<IDENTIFIER>` in the URL with the actual values (URL-encoded where needed).
111
+
112
+ ## Troubleshooting
113
+
114
+ - If curl times out, the Loki instance may be under heavy load — retry with a shorter time range or lower limit.
115
+ - If you get no results, confirm the call_id is correct and try the other environment.
116
+ - For very old calls (>48h), increase the time range or ask the user for an approximate time window.
117
+ - All user-provided times are in **IST (UTC+5:30)** — convert to UTC epoch before querying.
118
+
119
+ ## Reference
120
+
121
+ For LogQL query syntax and more filtering options, see [query-reference.md](query-reference.md).
@@ -0,0 +1,113 @@
1
+ # LogQL Query Reference for Pipecat Logs
2
+
3
+ ## Base Query Pattern
4
+
5
+ ```logql
6
+ {application="pipecat", environment="<env>"} |= `<call_id>` | json | level=~"(?i)DEBUG|INFO|WARNING|ERROR|FATAL" | line_format `{{.message}}`
7
+ ```
8
+
9
+ ## Common Variations
10
+
11
+ ### Filter by log level
12
+
13
+ **Errors only:**
14
+ ```logql
15
+ {application="pipecat", environment="staging"} |= `<call_id>` | json | level=~"(?i)ERROR|FATAL" | line_format `{{.message}}`
16
+ ```
17
+
18
+ **Warnings and above:**
19
+ ```logql
20
+ {application="pipecat", environment="staging"} |= `<call_id>` | json | level=~"(?i)WARNING|ERROR|FATAL" | line_format `{{.message}}`
21
+ ```
22
+
23
+ ### Filter by keyword
24
+
25
+ **LLM-related logs:**
26
+ ```logql
27
+ {application="pipecat", environment="staging"} |= `<call_id>` | json | level=~"(?i)DEBUG|INFO|WARNING|ERROR|FATAL" | line_format `{{.message}}` |= "LLM"
28
+ ```
29
+
30
+ **TTS-related logs:**
31
+ ```logql
32
+ {application="pipecat", environment="staging"} |= `<call_id>` | json | line_format `{{.message}}` |= "TTS"
33
+ ```
34
+
35
+ **Tool/function call logs:**
36
+ ```logql
37
+ {application="pipecat", environment="staging"} |= `<call_id>` | json | line_format `{{.message}}` |~ "function|tool_call|generic_function"
38
+ ```
39
+
40
+ **VAD/speech detection:**
41
+ ```logql
42
+ {application="pipecat", environment="staging"} |= `<call_id>` | json | line_format `{{.message}}` |~ "VAD|speaking|speech|silence|idle"
43
+ ```
44
+
45
+ ### Search across all calls in an environment
46
+
47
+ **Recent errors (no call_id filter):**
48
+ ```logql
49
+ {application="pipecat", environment="staging"} | json | level=~"(?i)ERROR|FATAL" | line_format `{{.message}}`
50
+ ```
51
+
52
+ **By pod name:**
53
+ ```logql
54
+ {application="pipecat", environment="staging", pod=~"pipecat-.*"} | json | line_format `{{.message}}`
55
+ ```
56
+
57
+ ## Loki API Endpoints
58
+
59
+ | Endpoint | Purpose |
60
+ |----------|---------|
61
+ | `GET /loki/api/v1/query_range` | Query logs over a time range |
62
+ | `GET /loki/api/v1/query` | Query logs at a single point in time |
63
+ | `GET /loki/api/v1/labels` | List all label names |
64
+ | `GET /loki/api/v1/label/<name>/values` | List values for a label |
65
+ | `GET /loki/api/v1/tail` | Stream logs via WebSocket |
66
+
67
+ ### API Parameters for query_range
68
+
69
+ | Parameter | Description | Example |
70
+ |-----------|-------------|---------|
71
+ | `query` | LogQL query string | `{application="pipecat"}` |
72
+ | `start` | Start timestamp (nanoseconds or RFC3339) | `1609459200000000000` |
73
+ | `end` | End timestamp (nanoseconds or RFC3339) | `1609545600000000000` |
74
+ | `limit` | Max entries to return | `5000` |
75
+ | `direction` | Sort order: `forward` or `backward` | `forward` |
76
+ | `step` | Query resolution step (for metrics) | `60s` |
77
+
78
+ ## Response Structure
79
+
80
+ ```json
81
+ {
82
+ "status": "success",
83
+ "data": {
84
+ "resultType": "streams",
85
+ "result": [
86
+ {
87
+ "stream": {
88
+ "application": "pipecat",
89
+ "environment": "staging",
90
+ "level": "INFO"
91
+ },
92
+ "values": [
93
+ ["1700000000000000000", "log message here"],
94
+ ["1700000001000000000", "another log message"]
95
+ ]
96
+ }
97
+ ]
98
+ }
99
+ }
100
+ ```
101
+
102
+ ## Environment Values
103
+
104
+ | Environment | Label Value | Description |
105
+ |-------------|-------------|-------------|
106
+ | Staging | `staging` | Test/staging environment |
107
+ | Production | `production` | Live production environment |
108
+
109
+ ## Infrastructure
110
+
111
+ - **Loki endpoint**: `http://35.154.72.110:3100`
112
+ - **Grafana UI**: `http://35.154.72.110:3000`
113
+ - **Loki datasource UID**: `eeey6hiactdz4c`
@@ -0,0 +1,121 @@
1
+ ---
2
+ name: loki-logs
3
+ description: Fetch and analyze pipecat application logs from Loki by call ID or call SID. Use when debugging call issues, investigating errors, or analyzing bot behavior for a specific call. Accepts a call_id (UUID) or call_sid (numeric string like 3341710001) and optional environment (staging/production).
4
+ argument-hint: <call_id|call_sid> [staging|production]
5
+ allowed-tools: Bash(curl *), Bash(jq *)
6
+ ---
7
+
8
+ # Loki Logs Fetcher
9
+
10
+ Fetch logs from Loki for a specific pipecat call and analyze them.
11
+
12
+ ## Parameters
13
+
14
+ - `$0` — **call_id or call_sid** (required): Either a UUID (e.g. `f3df923e-d535-4eff-a3c8-fefbae0e73bf`) or a numeric call SID string (e.g. `3341710001`)
15
+ - `$1` — **environment** (optional): `production` (default) or `staging`
16
+
17
+ ## Instructions
18
+
19
+ When invoked, follow these steps:
20
+
21
+ ### 1. Parse arguments
22
+
23
+ ```
24
+ IDENTIFIER = $0
25
+ ENV = $1 (default: "production")
26
+ ```
27
+
28
+ If `ENV` is `prod`, normalize it to `production`.
29
+ If `IDENTIFIER` is missing, ask the user for it.
30
+
31
+ Detect the identifier type:
32
+ - **UUID format** (contains hyphens, hex chars, e.g. `f3df923e-d535-...`): This is a `call_id`
33
+ - **Numeric string** (digits only, e.g. `3341710001`): This is a `call_sid`
34
+
35
+ Both work the same way in the Loki query — they are used as a substring match (`|=`) against the log lines.
36
+
37
+ ### 2. Fetch logs from Loki
38
+
39
+ Use the Loki HTTP API at `http://35.154.72.110:3100` to query logs.
40
+
41
+ The LogQL query to use:
42
+
43
+ ```
44
+ {application="pipecat", environment="<ENV>"} |= `<IDENTIFIER>` | json | level=~"(?i)DEBUG|INFO|WARNING|ERROR|FATAL" | line_format `{{.message}}`
45
+ ```
46
+
47
+ Execute this curl command (default time range: last 24 hours):
48
+
49
+ **Timezone note:** If the user provides a specific time or time range, treat it as **IST (Asia/Kolkata, UTC+5:30)**. Convert to UTC epoch before querying Loki.
50
+
51
+ ```bash
52
+ # Calculate timestamps (nanoseconds) — default: last 24 hours
53
+ END=$(date +%s)000000000
54
+ START=$(( $(date +%s) - 86400 ))000000000
55
+
56
+ curl -s "http://35.154.72.110:3100/loki/api/v1/query_range" \
57
+ --data-urlencode "query={application=\"pipecat\", environment=\"<ENV>\"} |= \`<IDENTIFIER>\` | json | level=~\"(?i)DEBUG|INFO|WARNING|ERROR|FATAL\" | line_format \`{{.message}}\`" \
58
+ --data-urlencode "start=$START" \
59
+ --data-urlencode "end=$END" \
60
+ --data-urlencode "limit=5000" \
61
+ --data-urlencode "direction=forward" | jq .
62
+ ```
63
+
64
+ If the result set is empty and the environment was `production`, suggest trying `staging` (and vice versa).
65
+
66
+ If the result set is empty for both, try expanding the time range to 48 hours.
67
+
68
+ ### 3. Parse and display the logs
69
+
70
+ Extract the log lines from the Loki JSON response. The response structure is:
71
+
72
+ ```json
73
+ {
74
+ "data": {
75
+ "result": [
76
+ {
77
+ "values": [
78
+ ["<timestamp_ns>", "<log_line>"]
79
+ ]
80
+ }
81
+ ]
82
+ }
83
+ }
84
+ ```
85
+
86
+ Display the logs in chronological order (earliest first). Show:
87
+ - Timestamp (human-readable)
88
+ - Log level (if parseable)
89
+ - Message content
90
+
91
+ ### 4. Analyze the logs
92
+
93
+ After displaying the logs, provide a brief analysis:
94
+
95
+ 1. **Call timeline**: What happened during this call? (connected, greeted, conversation flow, ended)
96
+ 2. **Errors/warnings**: Highlight any ERROR or WARNING level logs
97
+ 3. **Tool calls**: List any function/tool calls made during the call
98
+ 4. **TTS/STT activity**: Note any speech-related events
99
+ 5. **Call outcome**: How did the call end? (normal hangup, error, transfer, timeout)
100
+ 6. **Anomalies**: Flag anything unusual (long silences, repeated errors, unexpected state transitions)
101
+
102
+ ### 5. Grafana link
103
+
104
+ Always provide a clickable Grafana Explore link for the user to view the logs in the browser:
105
+
106
+ ```
107
+ http://35.154.72.110:3000/explore?schemaVersion=1&panes=%7B%221f1%22%3A%7B%22datasource%22%3A%22eeey6hiactdz4c%22%2C%22queries%22%3A%5B%7B%22datasource%22%3A%7B%22type%22%3A%22loki%22%2C%22uid%22%3A%22eeey6hiactdz4c%22%7D%2C%22direction%22%3A%22backward%22%2C%22editorMode%22%3A%22code%22%2C%22expr%22%3A%22%7Bapplication%3D%5C%22pipecat%5C%22%2C+environment%3D%5C%22<ENV>%5C%22%7D+%7C%3D+%60<IDENTIFIER>%60+%7C+json+%7C+level%3D%7E%5C%22%28%3Fi%29DEBUG%7CINFO%7CWARNING%7CERROR%7C+FATAL%5C%22+%7C+line_format+%60%7B%7B.message%7D%7D%60%22%2C%22queryType%22%3A%22range%22%2C%22refId%22%3A%22A%22%7D%5D%2C%22range%22%3A%7B%22from%22%3A%22now-6h%22%2C%22to%22%3A%22now%22%7D%2C%22compact%22%3Afalse%7D%7D&orgId=1
108
+ ```
109
+
110
+ Replace `<ENV>` and `<IDENTIFIER>` in the URL with the actual values (URL-encoded where needed).
111
+
112
+ ## Troubleshooting
113
+
114
+ - If curl times out, the Loki instance may be under heavy load — retry with a shorter time range or lower limit.
115
+ - If you get no results, confirm the call_id is correct and try the other environment.
116
+ - For very old calls (>48h), increase the time range or ask the user for an approximate time window.
117
+ - All user-provided times are in **IST (UTC+5:30)** — convert to UTC epoch before querying.
118
+
119
+ ## Reference
120
+
121
+ For LogQL query syntax and more filtering options, see [query-reference.md](query-reference.md).
@@ -0,0 +1,113 @@
1
+ # LogQL Query Reference for Pipecat Logs
2
+
3
+ ## Base Query Pattern
4
+
5
+ ```logql
6
+ {application="pipecat", environment="<env>"} |= `<call_id>` | json | level=~"(?i)DEBUG|INFO|WARNING|ERROR|FATAL" | line_format `{{.message}}`
7
+ ```
8
+
9
+ ## Common Variations
10
+
11
+ ### Filter by log level
12
+
13
+ **Errors only:**
14
+ ```logql
15
+ {application="pipecat", environment="staging"} |= `<call_id>` | json | level=~"(?i)ERROR|FATAL" | line_format `{{.message}}`
16
+ ```
17
+
18
+ **Warnings and above:**
19
+ ```logql
20
+ {application="pipecat", environment="staging"} |= `<call_id>` | json | level=~"(?i)WARNING|ERROR|FATAL" | line_format `{{.message}}`
21
+ ```
22
+
23
+ ### Filter by keyword
24
+
25
+ **LLM-related logs:**
26
+ ```logql
27
+ {application="pipecat", environment="staging"} |= `<call_id>` | json | level=~"(?i)DEBUG|INFO|WARNING|ERROR|FATAL" | line_format `{{.message}}` |= "LLM"
28
+ ```
29
+
30
+ **TTS-related logs:**
31
+ ```logql
32
+ {application="pipecat", environment="staging"} |= `<call_id>` | json | line_format `{{.message}}` |= "TTS"
33
+ ```
34
+
35
+ **Tool/function call logs:**
36
+ ```logql
37
+ {application="pipecat", environment="staging"} |= `<call_id>` | json | line_format `{{.message}}` |~ "function|tool_call|generic_function"
38
+ ```
39
+
40
+ **VAD/speech detection:**
41
+ ```logql
42
+ {application="pipecat", environment="staging"} |= `<call_id>` | json | line_format `{{.message}}` |~ "VAD|speaking|speech|silence|idle"
43
+ ```
44
+
45
+ ### Search across all calls in an environment
46
+
47
+ **Recent errors (no call_id filter):**
48
+ ```logql
49
+ {application="pipecat", environment="staging"} | json | level=~"(?i)ERROR|FATAL" | line_format `{{.message}}`
50
+ ```
51
+
52
+ **By pod name:**
53
+ ```logql
54
+ {application="pipecat", environment="staging", pod=~"pipecat-.*"} | json | line_format `{{.message}}`
55
+ ```
56
+
57
+ ## Loki API Endpoints
58
+
59
+ | Endpoint | Purpose |
60
+ |----------|---------|
61
+ | `GET /loki/api/v1/query_range` | Query logs over a time range |
62
+ | `GET /loki/api/v1/query` | Query logs at a single point in time |
63
+ | `GET /loki/api/v1/labels` | List all label names |
64
+ | `GET /loki/api/v1/label/<name>/values` | List values for a label |
65
+ | `GET /loki/api/v1/tail` | Stream logs via WebSocket |
66
+
67
+ ### API Parameters for query_range
68
+
69
+ | Parameter | Description | Example |
70
+ |-----------|-------------|---------|
71
+ | `query` | LogQL query string | `{application="pipecat"}` |
72
+ | `start` | Start timestamp (nanoseconds or RFC3339) | `1609459200000000000` |
73
+ | `end` | End timestamp (nanoseconds or RFC3339) | `1609545600000000000` |
74
+ | `limit` | Max entries to return | `5000` |
75
+ | `direction` | Sort order: `forward` or `backward` | `forward` |
76
+ | `step` | Query resolution step (for metrics) | `60s` |
77
+
78
+ ## Response Structure
79
+
80
+ ```json
81
+ {
82
+ "status": "success",
83
+ "data": {
84
+ "resultType": "streams",
85
+ "result": [
86
+ {
87
+ "stream": {
88
+ "application": "pipecat",
89
+ "environment": "staging",
90
+ "level": "INFO"
91
+ },
92
+ "values": [
93
+ ["1700000000000000000", "log message here"],
94
+ ["1700000001000000000", "another log message"]
95
+ ]
96
+ }
97
+ ]
98
+ }
99
+ }
100
+ ```
101
+
102
+ ## Environment Values
103
+
104
+ | Environment | Label Value | Description |
105
+ |-------------|-------------|-------------|
106
+ | Staging | `staging` | Test/staging environment |
107
+ | Production | `production` | Live production environment |
108
+
109
+ ## Infrastructure
110
+
111
+ - **Loki endpoint**: `http://35.154.72.110:3100`
112
+ - **Grafana UI**: `http://35.154.72.110:3000`
113
+ - **Loki datasource UID**: `eeey6hiactdz4c`
@@ -71,6 +71,11 @@ npm-debug.log*
71
71
  *.njsproj
72
72
  *.sln
73
73
  *.sw?
74
+ ringg-bot/eval/out/*
75
+ ringg-bot/eval/inputs/*
76
+ ringg-bot/eval/report/*
77
+ ringg-bot/eval/samples/*
78
+ ringg-bot/eval/comparison_analysis/*
74
79
 
75
80
  # Auto-generated docs
76
81
  docs/api