sentdm-voice-agents 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.
- sentdm_voice_agents-0.1.0/.github/CODEOWNERS +1 -0
- sentdm_voice_agents-0.1.0/.github/workflows/ci.yml +40 -0
- sentdm_voice_agents-0.1.0/.github/workflows/publish-pypi.yml +23 -0
- sentdm_voice_agents-0.1.0/.github/workflows/release-please.yml +34 -0
- sentdm_voice_agents-0.1.0/.gitignore +7 -0
- sentdm_voice_agents-0.1.0/.release-please-manifest.json +1 -0
- sentdm_voice_agents-0.1.0/CHANGELOG.md +8 -0
- sentdm_voice_agents-0.1.0/CLAUDE.md +35 -0
- sentdm_voice_agents-0.1.0/LICENSE +201 -0
- sentdm_voice_agents-0.1.0/PKG-INFO +90 -0
- sentdm_voice_agents-0.1.0/README.md +67 -0
- sentdm_voice_agents-0.1.0/REVIEW.md +15 -0
- sentdm_voice_agents-0.1.0/SECURITY.md +15 -0
- sentdm_voice_agents-0.1.0/pyproject.toml +40 -0
- sentdm_voice_agents-0.1.0/release-please-config.json +27 -0
- sentdm_voice_agents-0.1.0/sentdm_voice_agents/__init__.py +47 -0
- sentdm_voice_agents-0.1.0/sentdm_voice_agents/agent.py +401 -0
- sentdm_voice_agents-0.1.0/sentdm_voice_agents/audio.py +29 -0
- sentdm_voice_agents-0.1.0/sentdm_voice_agents/conformance/__init__.py +0 -0
- sentdm_voice_agents-0.1.0/sentdm_voice_agents/conformance/__main__.py +73 -0
- sentdm_voice_agents-0.1.0/sentdm_voice_agents/frames.py +909 -0
- sentdm_voice_agents-0.1.0/sentdm_voice_agents/session.py +189 -0
- sentdm_voice_agents-0.1.0/sentdm_voice_agents/version.py +1 -0
- sentdm_voice_agents-0.1.0/tests/conftest.py +17 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/agent.say/missing-session.json +4 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/connection.ready/no-session-cap.json +5 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/error/without-message.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/pong/string-ts.json +4 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.end/reason-not-a-code.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.resume/api-key-as-token.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.resume/short-token.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.resume/without-received.json +5 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.resumed/negative-received.json +5 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.resumed/stream-zero.json +8 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.start/audio-without-stream.json +17 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.start/epoch-started-at.json +17 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.start/number-not-e164.json +17 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.start/number-without-value.json +16 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.start/provider-call-id.json +17 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.start/resume-without-window.json +20 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/session.start/stream-zero.json +20 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/tool.call/dtmf-letters.json +9 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/tool.call/hold-without-state.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/tool.call/transfer-to-conference.json +12 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/tool.call/transfer-without-target.json +7 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/tool.result/failure-without-error.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/user.said/empty-text.json +5 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/invalid/user.said/too-long.json +5 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/agent.clear/clear.json +4 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/agent.say/greeting.json +5 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/agent.say/streamed-piece.json +7 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/connection.draining/draining.json +3 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/connection.ready/ready.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/error/not-allowed.json +9 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/error/resume-failed.json +9 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/ping/ping.json +4 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/pong/pong.json +4 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/session.end/reason-added-later.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/session.end/transferred.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/session.resume/after-loss.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/session.resumed/audio-new-stream.json +12 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/session.resumed/ended-while-detached.json +5 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/session.resumed/text.json +9 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/session.start/anonymous-caller.json +16 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/session.start/inbound-text.json +19 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/session.start/outbound-audio.json +25 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/session.start/party-kind-added-later.json +17 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/session.start/resumable.json +21 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/tool.call/hangup.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/tool.call/hold.json +9 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/tool.call/send-dtmf.json +9 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/tool.call/tool-added-later.json +9 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/tool.call/transfer-to-number.json +12 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/tool.call/transfer-to-user.json +12 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/tool.result/ok.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/tool.result/refused.json +10 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/user.said/correction.json +6 -0
- sentdm_voice_agents-0.1.0/tests/fixtures/valid/user.said/utterance.json +5 -0
- sentdm_voice_agents-0.1.0/tests/test_conformance.py +11 -0
- sentdm_voice_agents-0.1.0/tests/test_frames.py +30 -0
- sentdm_voice_agents-0.1.0/tests/test_session.py +96 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @sentdm/backend
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches: [main]
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
name: test
|
|
13
|
+
runs-on: ubuntu-24.04
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
python: ['3.11', '3.13']
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
persist-credentials: false
|
|
21
|
+
- uses: astral-sh/setup-uv@v6
|
|
22
|
+
- run: uv sync --python ${{ matrix.python }}
|
|
23
|
+
- run: uv run --python ${{ matrix.python }} pytest -q
|
|
24
|
+
|
|
25
|
+
conformance:
|
|
26
|
+
name: conformance
|
|
27
|
+
# The protocol's scenarios against this SDK's conformance agent, at the protocol tag the package implements.
|
|
28
|
+
runs-on: ubuntu-24.04
|
|
29
|
+
steps:
|
|
30
|
+
- uses: actions/checkout@v4
|
|
31
|
+
with:
|
|
32
|
+
persist-credentials: false
|
|
33
|
+
- uses: actions/setup-node@v4
|
|
34
|
+
with:
|
|
35
|
+
node-version: '22'
|
|
36
|
+
- uses: astral-sh/setup-uv@v6
|
|
37
|
+
- run: uv sync --python 3.12
|
|
38
|
+
- uses: sentdm/sent-dm-voice-protocol@v0.2.0
|
|
39
|
+
with:
|
|
40
|
+
agent: uv run --python 3.12 python -m sentdm_voice_agents.conformance
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Runs when release-please publishes a release, and by hand to publish again if a run failed.
|
|
2
|
+
name: Publish PyPI
|
|
3
|
+
on:
|
|
4
|
+
workflow_dispatch:
|
|
5
|
+
release:
|
|
6
|
+
types: [published]
|
|
7
|
+
|
|
8
|
+
jobs:
|
|
9
|
+
publish:
|
|
10
|
+
name: publish
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
id-token: write # PyPI trusted publishing
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
persist-credentials: false
|
|
19
|
+
- uses: astral-sh/setup-uv@v6
|
|
20
|
+
- name: Build
|
|
21
|
+
run: uv build
|
|
22
|
+
- name: Publish
|
|
23
|
+
run: uv publish --trusted-publishing always
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: Release Please
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- main
|
|
6
|
+
# By hand too: after a tag or release is fixed outside release-please, a run
|
|
7
|
+
# re-reads the releases without waiting for the next merge.
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: write
|
|
12
|
+
pull-requests: write
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
release-please:
|
|
16
|
+
if: github.repository == 'sentdm/sent-dm-voice-agents-python'
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
env:
|
|
19
|
+
HAS_APP: ${{ secrets.SDK_APP_ID != '' && secrets.SDK_APP_PRIVATE_KEY != '' }}
|
|
20
|
+
steps:
|
|
21
|
+
- name: Mint the release token from the GitHub App
|
|
22
|
+
# A tag or release created with the built-in token starts no
|
|
23
|
+
# workflow; the App's token does, and never expires on a calendar.
|
|
24
|
+
id: app
|
|
25
|
+
if: env.HAS_APP == 'true'
|
|
26
|
+
uses: actions/create-github-app-token@fee1f7d63c2ff003460e3d139729b119787bc349 # v3.3.0
|
|
27
|
+
with:
|
|
28
|
+
app-id: ${{ secrets.SDK_APP_ID }}
|
|
29
|
+
private-key: ${{ secrets.SDK_APP_PRIVATE_KEY }}
|
|
30
|
+
owner: ${{ github.repository_owner }}
|
|
31
|
+
repositories: ${{ github.event.repository.name }}
|
|
32
|
+
- uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1
|
|
33
|
+
with:
|
|
34
|
+
token: ${{ steps.app.outputs.token || github.token }}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{".":"0.1.0"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Working in sent-dm-voice-agents-python
|
|
2
|
+
|
|
3
|
+
The Sent Voice Agents SDK for Python. Rendered by `sent-dm-sdk-pipeline` (`voice-agents/`) from
|
|
4
|
+
`sent-dm-voice-protocol` at a pinned tag; the lane regenerates the generated parts on a protocol tag.
|
|
5
|
+
|
|
6
|
+
## What is generated and what is written
|
|
7
|
+
|
|
8
|
+
- **Generated, do not edit**: `sentdm_voice_agents/frames.py`. A change there is a change to the protocol or to
|
|
9
|
+
the lane's emitter in `sent-dm-sdk-pipeline`.
|
|
10
|
+
- **Rendered from the lane's template**: everything else. A fix here is welcome; the lane carries it back into
|
|
11
|
+
the template so every rendered repo gets it.
|
|
12
|
+
- **release-please-owned**: `CHANGELOG.md`, `.release-please-manifest.json`, the version in `pyproject.toml` and
|
|
13
|
+
`sentdm_voice_agents/version.py`.
|
|
14
|
+
|
|
15
|
+
## Rules
|
|
16
|
+
|
|
17
|
+
- The protocol's conformance scenarios run in CI on every PR, against `python -m sentdm_voice_agents.conformance`.
|
|
18
|
+
A PR that fails them does not merge; a release never ships without them green.
|
|
19
|
+
- The runtime follows `docs/protocol.md` in the protocol repository, not the other way round. When the protocol
|
|
20
|
+
and the code disagree, the protocol is right and the code changes.
|
|
21
|
+
- Never log a resume token or an API key.
|
|
22
|
+
- Branches named `release-please--branches--main` belong to release-please. Don't push to them or merge into
|
|
23
|
+
them. Merging the release PR tags the release and publishes to PyPI.
|
|
24
|
+
|
|
25
|
+
## Commits and pull requests
|
|
26
|
+
|
|
27
|
+
- **Conventional Commits drive release-please**: `feat:`, `fix:`, `chore:`, `docs:`. The subject becomes the
|
|
28
|
+
changelog line customers read, so write it for them: what changed, and what to do about it.
|
|
29
|
+
- **`ci:` and `test:` are hidden from the changelog.** `chore:`, `docs:`, `feat:` and `fix:` are not, and any of
|
|
30
|
+
them cuts a release when the release PR is merged.
|
|
31
|
+
- **PR titles carry no type prefix**: `voice-agents-python: <what changed>`. PRs land with a merge commit, and
|
|
32
|
+
release-please reads a conventional PR title as one more commit, so a `feat:` title lists the change twice.
|
|
33
|
+
- **One logical change per PR.**
|
|
34
|
+
- **Never name the calling provider** in code, comments, docs, changelogs or release notes. Sent is the
|
|
35
|
+
provider as far as this SDK is concerned.
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Sent
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sentdm-voice-agents
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Sent Voice Agents for Python: an AI agent that takes and places phone calls through Sent
|
|
5
|
+
Project-URL: Homepage, https://docs.sent.dm
|
|
6
|
+
Project-URL: Repository, https://github.com/sentdm/sent-dm-voice-agents-python
|
|
7
|
+
Project-URL: Protocol, https://github.com/sentdm/sent-dm-voice-protocol
|
|
8
|
+
Author-email: Sent <support@sent.dm>
|
|
9
|
+
License-Expression: Apache-2.0
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: agents,calls,sent,voice,websocket
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Communications :: Telephony
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: websockets>=13
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# Sent Voice Agents for Python
|
|
25
|
+
|
|
26
|
+
An AI agent that takes and places phone calls through [Sent](https://sent.dm), on the
|
|
27
|
+
[Sent Voice Agents protocol](https://github.com/sentdm/sent-dm-voice-protocol) 0.2.0.
|
|
28
|
+
|
|
29
|
+
Status: Preview, with the protocol. Generated and rendered by `sent-dm-sdk-pipeline` from the protocol at
|
|
30
|
+
`v0.2.0`; every release passes the protocol's conformance scenarios in CI.
|
|
31
|
+
|
|
32
|
+
Read the [Voice Agents docs](https://docs.sent.dm) to get started.
|
|
33
|
+
|
|
34
|
+
## Install
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
pip install sentdm-voice-agents
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Python 3.11 or later. The one dependency is `websockets`.
|
|
41
|
+
|
|
42
|
+
## Quickstart
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
from sentdm_voice_agents import Agent, Session
|
|
46
|
+
|
|
47
|
+
class Support(Agent):
|
|
48
|
+
async def on_session_start(self, session: Session) -> None:
|
|
49
|
+
await session.say("Hi, this is Acme support. How can I help?")
|
|
50
|
+
|
|
51
|
+
async def on_user_said(self, session: Session, said) -> None:
|
|
52
|
+
if "person" in said.text:
|
|
53
|
+
await session.say("Transferring you now.")
|
|
54
|
+
await session.transfer("+14155550100")
|
|
55
|
+
else:
|
|
56
|
+
await session.say(f"You said {said.text}")
|
|
57
|
+
|
|
58
|
+
Support(api_key="sk_live_...", agent_id="agent_...").serve()
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`serve()` connects to Sent with the account API key and serves calls until SIGINT or SIGTERM; `await
|
|
62
|
+
agent.run()` does the same inside your own event loop. Each session's handlers run in order on their own task,
|
|
63
|
+
so sessions never wait for one another. The runtime answers heartbeats, opens a new connection when one drains
|
|
64
|
+
or is lost, and resumes the sessions that can move; the handlers only see calls.
|
|
65
|
+
|
|
66
|
+
| Handler | When |
|
|
67
|
+
| --- | --- |
|
|
68
|
+
| `on_session_start(session)` | A call reached the agent. In a text session, `say()` to speak |
|
|
69
|
+
| `on_user_said(session, said)` | Text sessions: the caller said something; `said.correction` means it replaces the previous one |
|
|
70
|
+
| `on_audio(session, samples)` | Audio sessions: the caller's audio, 16-bit mono PCM at `session.sample_rate` |
|
|
71
|
+
| `on_tool_result(session, result)` | Sent answered a tool call; the awaiting call gets the same result |
|
|
72
|
+
| `on_session_end(session, end)` | The call left the agent; `end.reason` says why |
|
|
73
|
+
| `on_session_lost(session)` | The connection was lost and the session could not be resumed |
|
|
74
|
+
|
|
75
|
+
On a `Session`: `say(text, last=True, interruptible=True)`, `clear()`, `send_audio(samples)`, and the tools
|
|
76
|
+
`transfer(to)`, `hangup()`, `send_dtmf(digits)`, `hold(held)`, each returning Sent's `ToolResult`. `session.from_`,
|
|
77
|
+
`to`, `direction`, `session_type`, `language`, `context`, `sample_rate` carry what `session.start` said.
|
|
78
|
+
|
|
79
|
+
`sentdm_voice_agents.frames` holds every frame as a type, with `decode()` and `encode()` that check the
|
|
80
|
+
protocol's rules; it is generated from the protocol and not edited by hand.
|
|
81
|
+
|
|
82
|
+
## Develop
|
|
83
|
+
|
|
84
|
+
```sh
|
|
85
|
+
uv sync # the package and its test dependencies
|
|
86
|
+
uv run pytest # the runtime and the frames against the protocol's fixtures
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The conformance scenarios run in CI through the protocol's action, against `python -m sentdm_voice_agents.conformance`.
|
|
90
|
+
Releases are cut by release-please from `main` and published to PyPI from GitHub Actions.
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Sent Voice Agents for Python
|
|
2
|
+
|
|
3
|
+
An AI agent that takes and places phone calls through [Sent](https://sent.dm), on the
|
|
4
|
+
[Sent Voice Agents protocol](https://github.com/sentdm/sent-dm-voice-protocol) 0.2.0.
|
|
5
|
+
|
|
6
|
+
Status: Preview, with the protocol. Generated and rendered by `sent-dm-sdk-pipeline` from the protocol at
|
|
7
|
+
`v0.2.0`; every release passes the protocol's conformance scenarios in CI.
|
|
8
|
+
|
|
9
|
+
Read the [Voice Agents docs](https://docs.sent.dm) to get started.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
pip install sentdm-voice-agents
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Python 3.11 or later. The one dependency is `websockets`.
|
|
18
|
+
|
|
19
|
+
## Quickstart
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
from sentdm_voice_agents import Agent, Session
|
|
23
|
+
|
|
24
|
+
class Support(Agent):
|
|
25
|
+
async def on_session_start(self, session: Session) -> None:
|
|
26
|
+
await session.say("Hi, this is Acme support. How can I help?")
|
|
27
|
+
|
|
28
|
+
async def on_user_said(self, session: Session, said) -> None:
|
|
29
|
+
if "person" in said.text:
|
|
30
|
+
await session.say("Transferring you now.")
|
|
31
|
+
await session.transfer("+14155550100")
|
|
32
|
+
else:
|
|
33
|
+
await session.say(f"You said {said.text}")
|
|
34
|
+
|
|
35
|
+
Support(api_key="sk_live_...", agent_id="agent_...").serve()
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
`serve()` connects to Sent with the account API key and serves calls until SIGINT or SIGTERM; `await
|
|
39
|
+
agent.run()` does the same inside your own event loop. Each session's handlers run in order on their own task,
|
|
40
|
+
so sessions never wait for one another. The runtime answers heartbeats, opens a new connection when one drains
|
|
41
|
+
or is lost, and resumes the sessions that can move; the handlers only see calls.
|
|
42
|
+
|
|
43
|
+
| Handler | When |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| `on_session_start(session)` | A call reached the agent. In a text session, `say()` to speak |
|
|
46
|
+
| `on_user_said(session, said)` | Text sessions: the caller said something; `said.correction` means it replaces the previous one |
|
|
47
|
+
| `on_audio(session, samples)` | Audio sessions: the caller's audio, 16-bit mono PCM at `session.sample_rate` |
|
|
48
|
+
| `on_tool_result(session, result)` | Sent answered a tool call; the awaiting call gets the same result |
|
|
49
|
+
| `on_session_end(session, end)` | The call left the agent; `end.reason` says why |
|
|
50
|
+
| `on_session_lost(session)` | The connection was lost and the session could not be resumed |
|
|
51
|
+
|
|
52
|
+
On a `Session`: `say(text, last=True, interruptible=True)`, `clear()`, `send_audio(samples)`, and the tools
|
|
53
|
+
`transfer(to)`, `hangup()`, `send_dtmf(digits)`, `hold(held)`, each returning Sent's `ToolResult`. `session.from_`,
|
|
54
|
+
`to`, `direction`, `session_type`, `language`, `context`, `sample_rate` carry what `session.start` said.
|
|
55
|
+
|
|
56
|
+
`sentdm_voice_agents.frames` holds every frame as a type, with `decode()` and `encode()` that check the
|
|
57
|
+
protocol's rules; it is generated from the protocol and not edited by hand.
|
|
58
|
+
|
|
59
|
+
## Develop
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
uv sync # the package and its test dependencies
|
|
63
|
+
uv run pytest # the runtime and the frames against the protocol's fixtures
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The conformance scenarios run in CI through the protocol's action, against `python -m sentdm_voice_agents.conformance`.
|
|
67
|
+
Releases are cut by release-please from `main` and published to PyPI from GitHub Actions.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Review guide
|
|
2
|
+
|
|
3
|
+
What a reviewer, human or agent, checks on every PR to this repository.
|
|
4
|
+
|
|
5
|
+
1. **Protocol first.** Does the change keep what `docs/protocol.md` in `sent-dm-voice-protocol` says, at the tag
|
|
6
|
+
`ci.yml` pins? Counting of frames, the resume rules, heartbeats, audio framing, the order of frames.
|
|
7
|
+
2. **Generated code untouched.** `sentdm_voice_agents/frames.py` changes only through the lane in
|
|
8
|
+
`sent-dm-sdk-pipeline`. A PR editing it by hand is wrong by construction.
|
|
9
|
+
3. **Conformance green.** The conformance job passed on the PR's head commit.
|
|
10
|
+
4. **Handlers never block the runtime.** A handler runs on the session's task; a slow handler delays that session
|
|
11
|
+
only. Nothing in a handler path may block the connection reader.
|
|
12
|
+
5. **No secrets in logs.** Resume tokens and API keys never reach a log line.
|
|
13
|
+
6. **Compatibility.** Unknown frames, fields, party kinds, end reasons and error codes are handled as the
|
|
14
|
+
protocol's Compatibility section asks: ignored, counted, or treated as the fallback.
|
|
15
|
+
7. **Changelog line.** A `feat:` or `fix:` subject a customer can read.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
## Reporting security issues
|
|
4
|
+
|
|
5
|
+
Sent takes security seriously. If you believe you have found a vulnerability in this SDK or in the Sent Voice service it talks to, report it to support@sent.dm before disclosing it anywhere else.
|
|
6
|
+
|
|
7
|
+
Include what you found, how to reproduce it, and the SDK version. You'll get an acknowledgement, and we'll keep you informed while we investigate and fix it.
|
|
8
|
+
|
|
9
|
+
## Responsible disclosure
|
|
10
|
+
|
|
11
|
+
Give us a reasonable amount of time to investigate and address the issue before making any information public. We won't take action against researchers who report in good faith and follow this policy.
|
|
12
|
+
|
|
13
|
+
## Supported versions
|
|
14
|
+
|
|
15
|
+
Security fixes ship in the latest release of `sentdm-voice-agents`. Upgrade to the latest version to receive them.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "sentdm-voice-agents"
|
|
3
|
+
version = "0.1.0" # x-release-please-version
|
|
4
|
+
description = "Sent Voice Agents for Python: an AI agent that takes and places phone calls through Sent"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "Apache-2.0"
|
|
7
|
+
requires-python = ">=3.11"
|
|
8
|
+
authors = [{ name = "Sent", email = "support@sent.dm" }]
|
|
9
|
+
keywords = ["sent", "voice", "agents", "calls", "websocket"]
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Development Status :: 3 - Alpha",
|
|
12
|
+
"Intended Audience :: Developers",
|
|
13
|
+
"Programming Language :: Python :: 3",
|
|
14
|
+
"Programming Language :: Python :: 3.11",
|
|
15
|
+
"Programming Language :: Python :: 3.12",
|
|
16
|
+
"Programming Language :: Python :: 3.13",
|
|
17
|
+
"Topic :: Communications :: Telephony",
|
|
18
|
+
"Typing :: Typed",
|
|
19
|
+
]
|
|
20
|
+
dependencies = ["websockets>=13"]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
Homepage = "https://docs.sent.dm"
|
|
24
|
+
Repository = "https://github.com/sentdm/sent-dm-voice-agents-python"
|
|
25
|
+
Protocol = "https://github.com/sentdm/sent-dm-voice-protocol"
|
|
26
|
+
|
|
27
|
+
[dependency-groups]
|
|
28
|
+
dev = ["pytest>=8", "pytest-asyncio>=0.24"]
|
|
29
|
+
|
|
30
|
+
[build-system]
|
|
31
|
+
requires = ["hatchling"]
|
|
32
|
+
build-backend = "hatchling.build"
|
|
33
|
+
|
|
34
|
+
[tool.hatch.build.targets.wheel]
|
|
35
|
+
packages = ["sentdm_voice_agents"]
|
|
36
|
+
|
|
37
|
+
[tool.pytest.ini_options]
|
|
38
|
+
asyncio_mode = "auto"
|
|
39
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
40
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
|
|
3
|
+
"packages": { ".": {} },
|
|
4
|
+
"release-type": "python",
|
|
5
|
+
"package-name": "sentdm-voice-agents",
|
|
6
|
+
"include-v-in-tag": true,
|
|
7
|
+
"include-component-in-tag": false,
|
|
8
|
+
"initial-version": "0.1.0",
|
|
9
|
+
"bump-minor-pre-major": true,
|
|
10
|
+
"bump-patch-for-minor-pre-major": false,
|
|
11
|
+
"pull-request-header": "Automated Release PR",
|
|
12
|
+
"pull-request-title-pattern": "release: ${version}",
|
|
13
|
+
"extra-files": ["sentdm_voice_agents/version.py"],
|
|
14
|
+
"changelog-sections": [
|
|
15
|
+
{ "type": "feat", "section": "Features" },
|
|
16
|
+
{ "type": "fix", "section": "Bug Fixes" },
|
|
17
|
+
{ "type": "perf", "section": "Performance Improvements" },
|
|
18
|
+
{ "type": "revert", "section": "Reverts" },
|
|
19
|
+
{ "type": "chore", "section": "Chores" },
|
|
20
|
+
{ "type": "docs", "section": "Documentation" },
|
|
21
|
+
{ "type": "style", "section": "Styles" },
|
|
22
|
+
{ "type": "refactor", "section": "Refactors" },
|
|
23
|
+
{ "type": "test", "section": "Tests", "hidden": true },
|
|
24
|
+
{ "type": "build", "section": "Build System" },
|
|
25
|
+
{ "type": "ci", "section": "Continuous Integration", "hidden": true }
|
|
26
|
+
]
|
|
27
|
+
}
|