livekit-plugins-hamming 1.5.1__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,179 @@
1
+ **/.vscode
2
+ **/.DS_Store
3
+
4
+ # Byte-compiled / optimized / DLL files
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+
9
+ # C extensions
10
+ *.so
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ wheels/
26
+ share/python-wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+ MANIFEST
31
+
32
+ # PyInstaller
33
+ # Usually these files are written by a python script from a template
34
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py,cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+ cover/
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+ db.sqlite3-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ .pybuilder/
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # pyenv
89
+ # For a library or package, you might want to ignore these files since the code is
90
+ # intended to run in multiple environments; otherwise, check them in:
91
+ # .python-version
92
+
93
+ # pipenv
94
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
96
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
97
+ # install all needed dependencies.
98
+ #Pipfile.lock
99
+
100
+ # poetry
101
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
102
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
103
+ # commonly ignored for libraries.
104
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
105
+ #poetry.lock
106
+
107
+ # pdm
108
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
109
+ #pdm.lock
110
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
111
+ # in version control.
112
+ # https://pdm.fming.dev/#use-with-ide
113
+ .pdm.toml
114
+
115
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
116
+ __pypackages__/
117
+
118
+ # Celery stuff
119
+ celerybeat-schedule
120
+ celerybeat.pid
121
+
122
+ # SageMath parsed files
123
+ *.sage.py
124
+
125
+ # Environments
126
+ .env
127
+ .venv
128
+ env/
129
+ venv/
130
+ ENV/
131
+ env.bak/
132
+ venv.bak/
133
+
134
+ # Spyder project settings
135
+ .spyderproject
136
+ .spyproject
137
+
138
+ # Rope project settings
139
+ .ropeproject
140
+
141
+ # mkdocs documentation
142
+ /site
143
+
144
+ # mypy
145
+ .mypy_cache/
146
+ .dmypy.json
147
+ dmypy.json
148
+
149
+ # trunk
150
+ .trunk/
151
+
152
+ # Pyre type checker
153
+ .pyre/
154
+
155
+ # pytype static type analyzer
156
+ .pytype/
157
+
158
+ # Cython debug symbols
159
+ cython_debug/
160
+
161
+ # PyCharm
162
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
163
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
164
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
165
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
166
+ .idea/
167
+
168
+ node_modules
169
+
170
+ credentials.json
171
+ pyrightconfig.json
172
+ docs/
173
+
174
+ # Database files
175
+ *.db
176
+
177
+
178
+ # Examples for development
179
+ examples/dev/*
@@ -0,0 +1,179 @@
1
+ Metadata-Version: 2.4
2
+ Name: livekit-plugins-hamming
3
+ Version: 1.5.1
4
+ Summary: Monitoring plugin for exporting LiveKit AgentSession call review payloads to Hamming
5
+ Project-URL: Documentation, https://docs.hamming.ai
6
+ Project-URL: Website, https://hamming.ai/
7
+ Project-URL: Source, https://github.com/livekit/agents
8
+ Author-email: Hamming <engineering@hamming.ai>
9
+ License-Expression: Apache-2.0
10
+ Keywords: ai,audio,hamming,livekit,monitoring,realtime,video,voice
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: Apache Software License
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3 :: Only
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Topic :: Multimedia :: Sound/Audio
17
+ Classifier: Topic :: Multimedia :: Video
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Requires-Python: >=3.10.0
20
+ Requires-Dist: aiohttp>=3.9
21
+ Requires-Dist: livekit-agents>=1.5.1
22
+ Description-Content-Type: text/markdown
23
+
24
+ # Hamming plugin for LiveKit Agents
25
+
26
+ Post-call monitoring for LiveKit Agents with Hamming.
27
+
28
+ ## Installation
29
+
30
+ Install the plugin from a checked out repository or extracted source archive:
31
+
32
+ ```bash
33
+ python -m pip install ./livekit-plugins/livekit-plugins-hamming
34
+ ```
35
+
36
+ ## Pre-requisites
37
+
38
+ You will need Hamming credentials before configuring the plugin.
39
+
40
+ - `HAMMING_API_KEY`
41
+ - `HAMMING_EXTERNAL_AGENT_ID`
42
+
43
+ Credentials can be passed directly or through environment variables.
44
+
45
+ ## Usage
46
+
47
+ ```python
48
+ import os
49
+
50
+ from livekit.agents import AgentSession, JobContext
51
+ from livekit.plugins import hamming
52
+
53
+
54
+ async def entrypoint(ctx: JobContext) -> None:
55
+ await ctx.connect()
56
+
57
+ hamming.configure_hamming(
58
+ api_key=os.environ["HAMMING_API_KEY"],
59
+ external_agent_id=os.environ["HAMMING_EXTERNAL_AGENT_ID"],
60
+ recording={"mode": "session_audio"},
61
+ )
62
+
63
+ session = AgentSession()
64
+ hamming.attach_session(session, job_ctx=ctx)
65
+ ```
66
+
67
+ ## Recording Modes
68
+
69
+ The plugin supports explicit recording modes through `configure_hamming(recording=...)`.
70
+ If `recording` is omitted, the plugin exports monitoring payloads only and does not start or resolve recordings.
71
+
72
+ - `none`
73
+ - Send monitoring payload only.
74
+ - `session_audio`
75
+ - Use LiveKit session recording and inline `recording_capture` on the final `/collect` payload.
76
+ - `participant_egress`
77
+ - Start managed LiveKit participant egress and send dual-track recording URLs derived from deterministic output paths.
78
+ - `room_composite`
79
+ - Start managed LiveKit room composite egress and send a single `recording_url` derived from a deterministic output path.
80
+
81
+ ### Session Audio (Default Simple Path)
82
+
83
+ ```python
84
+ hamming.configure_hamming(
85
+ api_key=os.environ["HAMMING_API_KEY"],
86
+ external_agent_id=os.environ["HAMMING_EXTERNAL_AGENT_ID"],
87
+ recording={"mode": "session_audio"},
88
+ )
89
+ ```
90
+
91
+ ### Managed Participant Egress
92
+
93
+ ```python
94
+ hamming.configure_hamming(
95
+ api_key=os.environ["HAMMING_API_KEY"],
96
+ external_agent_id=os.environ["HAMMING_EXTERNAL_AGENT_ID"],
97
+ recording={
98
+ "mode": "participant_egress",
99
+ "livekit": {
100
+ "url": os.environ["LIVEKIT_URL"],
101
+ "api_key": os.environ["LIVEKIT_API_KEY"],
102
+ "api_secret": os.environ["LIVEKIT_API_SECRET"],
103
+ },
104
+ "s3": {
105
+ # Required for deterministic artifact URL resolution.
106
+ "public_url_base": os.environ.get("LIVEKIT_RECORDING_PUBLIC_URL_BASE", ""),
107
+ # Optional. Include upload credentials only if the plugin should write
108
+ # directly to S3 instead of relying on LiveKit project defaults.
109
+ "access_key": os.environ.get("LIVEKIT_RECORDING_S3_ACCESS_KEY", ""),
110
+ "secret": os.environ.get("LIVEKIT_RECORDING_S3_SECRET", ""),
111
+ "region": os.environ.get("LIVEKIT_RECORDING_S3_REGION", ""),
112
+ "bucket": os.environ.get("LIVEKIT_RECORDING_S3_BUCKET", ""),
113
+ },
114
+ },
115
+ )
116
+ ```
117
+
118
+ ### Managed Room Composite
119
+
120
+ ```python
121
+ hamming.configure_hamming(
122
+ api_key=os.environ["HAMMING_API_KEY"],
123
+ external_agent_id=os.environ["HAMMING_EXTERNAL_AGENT_ID"],
124
+ recording={
125
+ "mode": "room_composite",
126
+ "livekit": {
127
+ "url": os.environ["LIVEKIT_URL"],
128
+ "api_key": os.environ["LIVEKIT_API_KEY"],
129
+ "api_secret": os.environ["LIVEKIT_API_SECRET"],
130
+ },
131
+ "audio_only": True,
132
+ "file_type": "ogg",
133
+ },
134
+ )
135
+ ```
136
+
137
+ Notes:
138
+
139
+ - Managed remote recording modes require LiveKit server API credentials.
140
+ - Managed remote recording modes also require `job_ctx` when calling `hamming.attach_session(...)`.
141
+ - Managed remote recording modes require deterministic artifact URL resolution via `recording.s3.public_url_base` or `recording.s3.bucket` + `recording.s3.region`.
142
+ - If you provide full S3 credentials, the plugin uses those upload settings for egress output.
143
+ - If you omit S3 upload credentials, your LiveKit project must already have default file output storage configured.
144
+ - The plugin does not poll LiveKit for completed artifact locations; it derives the final public URLs from the configured output path.
145
+
146
+ ## Verify configuration
147
+
148
+ ```python
149
+ import os
150
+
151
+ from livekit.plugins import hamming
152
+
153
+ report = hamming.doctor(api_key=os.environ["HAMMING_API_KEY"])
154
+ print(report.to_dict())
155
+ ```
156
+
157
+ ## Notes
158
+
159
+ - Sessions are exported when attached through `hamming.attach_session(...)`.
160
+ - Recording is opt-in. Omitting `recording=...` sends monitoring payloads without recording artifacts.
161
+ - `auto_record_audio=True` is still supported as a backward-compatible alias for `recording={"mode": "session_audio"}`.
162
+ - Managed remote recording modes stop egress on close and send deterministic artifact URLs through the same `/api/rest/v2/collect` ingestion path.
163
+
164
+ ## Troubleshooting
165
+
166
+ - `RuntimeError: hamming is not configured`
167
+ - Call `hamming.configure_hamming(...)` before `hamming.attach_session(...)`.
168
+ - `ValueError: Hamming API key required`
169
+ - Set `HAMMING_API_KEY` or pass `api_key=...`.
170
+ - `external_agent_id is required`
171
+ - Set `HAMMING_EXTERNAL_AGENT_ID` or pass `external_agent_id=...`.
172
+ - `Unsupported recording mode`
173
+ - Use `none`, `session_audio`, `participant_egress`, or `room_composite`.
174
+ - `recording mode 'participant_egress' requires LiveKit server credentials`
175
+ - Provide `recording.livekit` or set `LIVEKIT_URL`, `LIVEKIT_API_KEY`, and `LIVEKIT_API_SECRET`.
176
+ - `recording mode 'participant_egress' requires deterministic artifact URL resolution`
177
+ - Provide `recording.s3.public_url_base` or `recording.s3.bucket` + `recording.s3.region`.
178
+ - `recording mode 'participant_egress' requires JobContext`
179
+ - Pass `job_ctx=ctx` to `hamming.attach_session(...)` or call it from inside the active LiveKit job.
@@ -0,0 +1,156 @@
1
+ # Hamming plugin for LiveKit Agents
2
+
3
+ Post-call monitoring for LiveKit Agents with Hamming.
4
+
5
+ ## Installation
6
+
7
+ Install the plugin from a checked out repository or extracted source archive:
8
+
9
+ ```bash
10
+ python -m pip install ./livekit-plugins/livekit-plugins-hamming
11
+ ```
12
+
13
+ ## Pre-requisites
14
+
15
+ You will need Hamming credentials before configuring the plugin.
16
+
17
+ - `HAMMING_API_KEY`
18
+ - `HAMMING_EXTERNAL_AGENT_ID`
19
+
20
+ Credentials can be passed directly or through environment variables.
21
+
22
+ ## Usage
23
+
24
+ ```python
25
+ import os
26
+
27
+ from livekit.agents import AgentSession, JobContext
28
+ from livekit.plugins import hamming
29
+
30
+
31
+ async def entrypoint(ctx: JobContext) -> None:
32
+ await ctx.connect()
33
+
34
+ hamming.configure_hamming(
35
+ api_key=os.environ["HAMMING_API_KEY"],
36
+ external_agent_id=os.environ["HAMMING_EXTERNAL_AGENT_ID"],
37
+ recording={"mode": "session_audio"},
38
+ )
39
+
40
+ session = AgentSession()
41
+ hamming.attach_session(session, job_ctx=ctx)
42
+ ```
43
+
44
+ ## Recording Modes
45
+
46
+ The plugin supports explicit recording modes through `configure_hamming(recording=...)`.
47
+ If `recording` is omitted, the plugin exports monitoring payloads only and does not start or resolve recordings.
48
+
49
+ - `none`
50
+ - Send monitoring payload only.
51
+ - `session_audio`
52
+ - Use LiveKit session recording and inline `recording_capture` on the final `/collect` payload.
53
+ - `participant_egress`
54
+ - Start managed LiveKit participant egress and send dual-track recording URLs derived from deterministic output paths.
55
+ - `room_composite`
56
+ - Start managed LiveKit room composite egress and send a single `recording_url` derived from a deterministic output path.
57
+
58
+ ### Session Audio (Default Simple Path)
59
+
60
+ ```python
61
+ hamming.configure_hamming(
62
+ api_key=os.environ["HAMMING_API_KEY"],
63
+ external_agent_id=os.environ["HAMMING_EXTERNAL_AGENT_ID"],
64
+ recording={"mode": "session_audio"},
65
+ )
66
+ ```
67
+
68
+ ### Managed Participant Egress
69
+
70
+ ```python
71
+ hamming.configure_hamming(
72
+ api_key=os.environ["HAMMING_API_KEY"],
73
+ external_agent_id=os.environ["HAMMING_EXTERNAL_AGENT_ID"],
74
+ recording={
75
+ "mode": "participant_egress",
76
+ "livekit": {
77
+ "url": os.environ["LIVEKIT_URL"],
78
+ "api_key": os.environ["LIVEKIT_API_KEY"],
79
+ "api_secret": os.environ["LIVEKIT_API_SECRET"],
80
+ },
81
+ "s3": {
82
+ # Required for deterministic artifact URL resolution.
83
+ "public_url_base": os.environ.get("LIVEKIT_RECORDING_PUBLIC_URL_BASE", ""),
84
+ # Optional. Include upload credentials only if the plugin should write
85
+ # directly to S3 instead of relying on LiveKit project defaults.
86
+ "access_key": os.environ.get("LIVEKIT_RECORDING_S3_ACCESS_KEY", ""),
87
+ "secret": os.environ.get("LIVEKIT_RECORDING_S3_SECRET", ""),
88
+ "region": os.environ.get("LIVEKIT_RECORDING_S3_REGION", ""),
89
+ "bucket": os.environ.get("LIVEKIT_RECORDING_S3_BUCKET", ""),
90
+ },
91
+ },
92
+ )
93
+ ```
94
+
95
+ ### Managed Room Composite
96
+
97
+ ```python
98
+ hamming.configure_hamming(
99
+ api_key=os.environ["HAMMING_API_KEY"],
100
+ external_agent_id=os.environ["HAMMING_EXTERNAL_AGENT_ID"],
101
+ recording={
102
+ "mode": "room_composite",
103
+ "livekit": {
104
+ "url": os.environ["LIVEKIT_URL"],
105
+ "api_key": os.environ["LIVEKIT_API_KEY"],
106
+ "api_secret": os.environ["LIVEKIT_API_SECRET"],
107
+ },
108
+ "audio_only": True,
109
+ "file_type": "ogg",
110
+ },
111
+ )
112
+ ```
113
+
114
+ Notes:
115
+
116
+ - Managed remote recording modes require LiveKit server API credentials.
117
+ - Managed remote recording modes also require `job_ctx` when calling `hamming.attach_session(...)`.
118
+ - Managed remote recording modes require deterministic artifact URL resolution via `recording.s3.public_url_base` or `recording.s3.bucket` + `recording.s3.region`.
119
+ - If you provide full S3 credentials, the plugin uses those upload settings for egress output.
120
+ - If you omit S3 upload credentials, your LiveKit project must already have default file output storage configured.
121
+ - The plugin does not poll LiveKit for completed artifact locations; it derives the final public URLs from the configured output path.
122
+
123
+ ## Verify configuration
124
+
125
+ ```python
126
+ import os
127
+
128
+ from livekit.plugins import hamming
129
+
130
+ report = hamming.doctor(api_key=os.environ["HAMMING_API_KEY"])
131
+ print(report.to_dict())
132
+ ```
133
+
134
+ ## Notes
135
+
136
+ - Sessions are exported when attached through `hamming.attach_session(...)`.
137
+ - Recording is opt-in. Omitting `recording=...` sends monitoring payloads without recording artifacts.
138
+ - `auto_record_audio=True` is still supported as a backward-compatible alias for `recording={"mode": "session_audio"}`.
139
+ - Managed remote recording modes stop egress on close and send deterministic artifact URLs through the same `/api/rest/v2/collect` ingestion path.
140
+
141
+ ## Troubleshooting
142
+
143
+ - `RuntimeError: hamming is not configured`
144
+ - Call `hamming.configure_hamming(...)` before `hamming.attach_session(...)`.
145
+ - `ValueError: Hamming API key required`
146
+ - Set `HAMMING_API_KEY` or pass `api_key=...`.
147
+ - `external_agent_id is required`
148
+ - Set `HAMMING_EXTERNAL_AGENT_ID` or pass `external_agent_id=...`.
149
+ - `Unsupported recording mode`
150
+ - Use `none`, `session_audio`, `participant_egress`, or `room_composite`.
151
+ - `recording mode 'participant_egress' requires LiveKit server credentials`
152
+ - Provide `recording.livekit` or set `LIVEKIT_URL`, `LIVEKIT_API_KEY`, and `LIVEKIT_API_SECRET`.
153
+ - `recording mode 'participant_egress' requires deterministic artifact URL resolution`
154
+ - Provide `recording.s3.public_url_base` or `recording.s3.bucket` + `recording.s3.region`.
155
+ - `recording mode 'participant_egress' requires JobContext`
156
+ - Pass `job_ctx=ctx` to `hamming.attach_session(...)` or call it from inside the active LiveKit job.
@@ -0,0 +1,55 @@
1
+ # Copyright 2026 Hamming, Inc.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Hamming plugin for LiveKit Agents.
16
+
17
+ Exports final post-call monitoring artifacts to Hamming.
18
+ """
19
+
20
+ from livekit.agents import Plugin
21
+
22
+ from ._setup import (
23
+ DoctorReport,
24
+ attach_session,
25
+ configure_hamming,
26
+ doctor,
27
+ doctor_json,
28
+ )
29
+ from .log import logger
30
+ from .version import __version__
31
+
32
+ __all__ = [
33
+ "configure_hamming",
34
+ "doctor",
35
+ "doctor_json",
36
+ "DoctorReport",
37
+ "attach_session",
38
+ "__version__",
39
+ ]
40
+
41
+
42
+ class HammingPlugin(Plugin):
43
+ def __init__(self) -> None:
44
+ super().__init__(__name__, __version__, __package__, logger)
45
+
46
+
47
+ Plugin.register_plugin(HammingPlugin())
48
+
49
+ # Cleanup docs of unexported modules
50
+ _module = dir()
51
+ NOT_IN_ALL = [m for m in _module if m not in __all__]
52
+
53
+ __pdoc__: dict[str, bool] = {}
54
+ for n in NOT_IN_ALL:
55
+ __pdoc__[n] = False