Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
f055bdf
chore(tests): add tests for httpx client instantiation & proxies
stainless-app[bot] Jun 16, 2025
56ff61e
chore(internal): update conftest.py
stainless-app[bot] Jun 16, 2025
3255f4a
chore(ci): enable for pull requests
stainless-app[bot] Jun 17, 2025
faaed6a
chore(readme): update badges
stainless-app[bot] Jun 17, 2025
82eb666
fix(tests): fix: tests which call HTTP endpoints directly with the ex…
stainless-app[bot] Jun 17, 2025
bbbf5ce
docs(client): fix httpx.Timeout documentation reference
stainless-app[bot] Jun 18, 2025
15b8af3
feat(api): api update
stainless-app[bot] Jun 18, 2025
e33361b
feat(api): api update
stainless-app[bot] Jun 18, 2025
3600f4c
feat(api): api update
stainless-app[bot] Jun 18, 2025
c3c2840
feat(client): add support for aiohttp
stainless-app[bot] Jun 20, 2025
2a5ba8b
feat(api): api update
stainless-app[bot] Jun 22, 2025
8273205
chore(tests): skip some failing tests on the latest python versions
stainless-app[bot] Jun 23, 2025
0703f82
feat(api): api update
stainless-app[bot] Jun 24, 2025
cced89c
fix(ci): release-doctor — report correct token name
stainless-app[bot] Jun 26, 2025
9771f59
feat(api): api update
stainless-app[bot] Jun 27, 2025
a4f71a1
feat(api): api update
stainless-app[bot] Jun 27, 2025
619e43a
chore(ci): only run for pushes and fork pull requests
stainless-app[bot] Jun 27, 2025
74d373a
codegen metadata
stainless-app[bot] Jun 28, 2025
3a5605f
fix(ci): correct conditional
stainless-app[bot] Jun 29, 2025
8231ac4
feat(api): api update
stainless-app[bot] Jun 29, 2025
95c3188
feat(api): api update
stainless-app[bot] Jun 29, 2025
9008270
release: 4.37.0
stainless-app[bot] Jun 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ on:
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/toddlzt-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

Expand All @@ -31,7 +36,7 @@ jobs:
run: ./scripts/lint

upload:
if: github.repository == 'stainless-sdks/toddlzt-python'
if: github.repository == 'stainless-sdks/toddlzt-python' && (github.event_name == 'push' || github.event.pull_request.head.repo.fork)
timeout-minutes: 10
name: upload
permissions:
Expand All @@ -58,6 +63,7 @@ jobs:
timeout-minutes: 10
name: test
runs-on: ${{ github.repository == 'stainless-sdks/toddlzt-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.36.0"
".": "4.37.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 39
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/retell%2Ftoddlzt-56f2d45e8cd73d9affbc60ffb07513d0ac62f19631854d3f376d066969f71bad.yml
openapi_spec_hash: ab9dac6b50dd93a8ef459e6e68660bac
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/retell%2Ftoddlzt-b9085cd6eb0e7f2798412d918e4327040bf1f7076a85001ea56ee7d55f7a306c.yml
openapi_spec_hash: a7b3e777b15c7901c94efa5a3132b9c0
config_hash: f4bc63f2350a2a4988750b41a0737f9d
39 changes: 39 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,44 @@
# Changelog

## 4.37.0 (2025-06-29)

Full Changelog: [v4.36.0...v4.37.0](https://github.com/RetellAI/retell-python-sdk/compare/v4.36.0...v4.37.0)

### Features

* **api:** api update ([95c3188](https://github.com/RetellAI/retell-python-sdk/commit/95c3188963aee89f451b3afd5b976ed2a222bd96))
* **api:** api update ([8231ac4](https://github.com/RetellAI/retell-python-sdk/commit/8231ac42d5758c5e9a211884222caddb43544c04))
* **api:** api update ([a4f71a1](https://github.com/RetellAI/retell-python-sdk/commit/a4f71a144677a3d9046cdfea1928a1683bce248a))
* **api:** api update ([9771f59](https://github.com/RetellAI/retell-python-sdk/commit/9771f599c1798c95828a9582c8d460723facd5d3))
* **api:** api update ([0703f82](https://github.com/RetellAI/retell-python-sdk/commit/0703f822fa8c51efe5cb0ca70174d8dacadc985a))
* **api:** api update ([2a5ba8b](https://github.com/RetellAI/retell-python-sdk/commit/2a5ba8bd792e3c10ec7ac0ca5025f300a06fe311))
* **api:** api update ([3600f4c](https://github.com/RetellAI/retell-python-sdk/commit/3600f4cf8833658591ef72e58e33df57dc223eb4))
* **api:** api update ([e33361b](https://github.com/RetellAI/retell-python-sdk/commit/e33361bc15fc80a3fcbb9be089742f7dfda7568b))
* **api:** api update ([15b8af3](https://github.com/RetellAI/retell-python-sdk/commit/15b8af3658b36e040a21fc5be3c28d2e3a45bf79))
* **client:** add support for aiohttp ([c3c2840](https://github.com/RetellAI/retell-python-sdk/commit/c3c2840e285d73c451f0a4e18ffcdf6d7bdff06a))


### Bug Fixes

* **ci:** correct conditional ([3a5605f](https://github.com/RetellAI/retell-python-sdk/commit/3a5605f8876535b1b8ee4b61d018afeaa6b21fdb))
* **ci:** release-doctor — report correct token name ([cced89c](https://github.com/RetellAI/retell-python-sdk/commit/cced89c6e18c338a66051764fdbcd7cd8decbba4))
* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([82eb666](https://github.com/RetellAI/retell-python-sdk/commit/82eb66606315b29827250d1db55cbc8d1201a770))


### Chores

* **ci:** enable for pull requests ([3255f4a](https://github.com/RetellAI/retell-python-sdk/commit/3255f4a2a7e57ae4dfc3e704c1895ca76d6eaeb4))
* **ci:** only run for pushes and fork pull requests ([619e43a](https://github.com/RetellAI/retell-python-sdk/commit/619e43a84070a10d57973a7d79d33131e639f2fa))
* **internal:** update conftest.py ([56ff61e](https://github.com/RetellAI/retell-python-sdk/commit/56ff61e8c2a353faf6b668d40b7ea96d57576789))
* **readme:** update badges ([faaed6a](https://github.com/RetellAI/retell-python-sdk/commit/faaed6a89f513e4de848ca569140f15989ec84f3))
* **tests:** add tests for httpx client instantiation & proxies ([f055bdf](https://github.com/RetellAI/retell-python-sdk/commit/f055bdf00ae2ab8d39684fd7674ac04845858170))
* **tests:** skip some failing tests on the latest python versions ([8273205](https://github.com/RetellAI/retell-python-sdk/commit/827320564ec4a33ce33e5b30ca155dd83fb3f324))


### Documentation

* **client:** fix httpx.Timeout documentation reference ([bbbf5ce](https://github.com/RetellAI/retell-python-sdk/commit/bbbf5ceee0d1f5ea5578fe22d5a5046afd17e925))

## 4.36.0 (2025-06-16)

Full Changelog: [v4.35.0...v4.36.0](https://github.com/RetellAI/retell-python-sdk/compare/v4.35.0...v4.36.0)
Expand Down
41 changes: 39 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Retell Python API library

[![PyPI version](https://img.shields.io/pypi/v/retell-sdk.svg)](https://pypi.org/project/retell-sdk/)
[![PyPI version](<https://img.shields.io/pypi/v/retell-sdk.svg?label=pypi%20(stable)>)](https://pypi.org/project/retell-sdk/)

The Retell Python library provides convenient access to the Retell REST API from any Python 3.8+
application. The library includes type definitions for all request params and response fields,
Expand Down Expand Up @@ -67,6 +67,43 @@ asyncio.run(main())

Functionality between the synchronous and asynchronous clients is otherwise identical.

### With aiohttp

By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.

You can enable this by installing `aiohttp`:

```sh
# install from PyPI
pip install retell-sdk[aiohttp]
```

Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:

```python
import asyncio
from retell import DefaultAioHttpClient
from retell import AsyncRetell


async def main() -> None:
async with AsyncRetell(
api_key="YOUR_RETELL_API_KEY",
http_client=DefaultAioHttpClient(),
) as client:
agent_response = await client.agent.create(
response_engine={
"llm_id": "llm_234sdertfsdsfsdf",
"type": "retell-llm",
},
voice_id="11labs-Adrian",
)
print(agent_response.agent_id)


asyncio.run(main())
```

## Using types

Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:
Expand Down Expand Up @@ -173,7 +210,7 @@ client.with_options(max_retries=5).agent.create(
### Timeouts

By default requests time out after 1 minute. You can configure this with a `timeout` option,
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:

```python
from retell import Retell
Expand Down
2 changes: 1 addition & 1 deletion bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
errors=()

if [ -z "${PYPI_TOKEN}" ]; then
errors+=("The RETELL_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.")
fi

lenErrors=${#errors[@]}
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "retell-sdk"
version = "4.36.0"
version = "4.37.0"
description = "The official Python library for the retell API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down Expand Up @@ -39,6 +39,8 @@ classifiers = [
Homepage = "https://github.com/RetellAI/retell-python-sdk"
Repository = "https://github.com/RetellAI/retell-python-sdk"

[project.optional-dependencies]
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.6"]

[tool.rye]
managed = true
Expand Down
27 changes: 27 additions & 0 deletions requirements-dev.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,24 @@
# universal: false

-e file:.
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.12.13
# via httpx-aiohttp
# via retell-sdk
aiosignal==1.3.2
# via aiohttp
annotated-types==0.6.0
# via pydantic
anyio==4.4.0
# via httpx
# via retell-sdk
argcomplete==3.1.2
# via nox
async-timeout==5.0.1
# via aiohttp
attrs==25.3.0
# via aiohttp
certifi==2023.7.22
# via httpcore
# via httpx
Expand All @@ -38,23 +49,33 @@ execnet==2.1.1
# via pytest-xdist
filelock==3.12.4
# via virtualenv
frozenlist==1.7.0
# via aiohttp
# via aiosignal
h11==0.14.0
# via httpcore
httpcore==1.0.2
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via respx
# via retell-sdk
httpx-aiohttp==0.1.6
# via retell-sdk
idna==3.4
# via anyio
# via httpx
# via yarl
importlib-metadata==7.0.0
iniconfig==2.0.0
# via pytest
markdown-it-py==3.0.0
# via rich
mdurl==0.1.2
# via markdown-it-py
multidict==6.5.0
# via aiohttp
# via yarl
mypy==1.14.1
mypy-extensions==1.0.0
# via mypy
Expand All @@ -69,6 +90,9 @@ platformdirs==3.11.0
# via virtualenv
pluggy==1.5.0
# via pytest
propcache==0.3.2
# via aiohttp
# via yarl
pycparser==2.22
# via cffi
pydantic==2.10.3
Expand Down Expand Up @@ -103,12 +127,15 @@ tomli==2.0.2
# via pytest
typing-extensions==4.12.2
# via anyio
# via multidict
# via mypy
# via pydantic
# via pydantic-core
# via pyright
# via retell-sdk
virtualenv==20.24.5
# via nox
yarl==1.20.1
# via aiohttp
zipp==3.17.0
# via importlib-metadata
27 changes: 27 additions & 0 deletions requirements.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,22 @@
# universal: false

-e file:.
aiohappyeyeballs==2.6.1
# via aiohttp
aiohttp==3.12.13
# via httpx-aiohttp
# via retell-sdk
aiosignal==1.3.2
# via aiohttp
annotated-types==0.6.0
# via pydantic
anyio==4.4.0
# via httpx
# via retell-sdk
async-timeout==5.0.1
# via aiohttp
attrs==25.3.0
# via aiohttp
certifi==2023.7.22
# via httpcore
# via httpx
Expand All @@ -26,15 +37,28 @@ distro==1.8.0
# via retell-sdk
exceptiongroup==1.2.2
# via anyio
frozenlist==1.7.0
# via aiohttp
# via aiosignal
h11==0.14.0
# via httpcore
httpcore==1.0.2
# via httpx
httpx==0.28.1
# via httpx-aiohttp
# via retell-sdk
httpx-aiohttp==0.1.6
# via retell-sdk
idna==3.4
# via anyio
# via httpx
# via yarl
multidict==6.5.0
# via aiohttp
# via yarl
propcache==0.3.2
# via aiohttp
# via yarl
pycparser==2.22
# via cffi
pydantic==2.10.3
Expand All @@ -46,6 +70,9 @@ sniffio==1.3.0
# via retell-sdk
typing-extensions==4.12.2
# via anyio
# via multidict
# via pydantic
# via pydantic-core
# via retell-sdk
yarl==1.20.1
# via aiohttp
3 changes: 2 additions & 1 deletion src/retell/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
UnprocessableEntityError,
APIResponseValidationError,
)
from ._base_client import DefaultHttpxClient, DefaultAsyncHttpxClient
from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient
from ._utils._logs import setup_logging as _setup_logging

__all__ = [
Expand Down Expand Up @@ -68,6 +68,7 @@
"DEFAULT_CONNECTION_LIMITS",
"DefaultHttpxClient",
"DefaultAsyncHttpxClient",
"DefaultAioHttpClient",
]

if not _t.TYPE_CHECKING:
Expand Down
22 changes: 22 additions & 0 deletions src/retell/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1284,6 +1284,24 @@ def __init__(self, **kwargs: Any) -> None:
super().__init__(**kwargs)


try:
import httpx_aiohttp
except ImportError:

class _DefaultAioHttpClient(httpx.AsyncClient):
def __init__(self, **_kwargs: Any) -> None:
raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra")
else:

class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore
def __init__(self, **kwargs: Any) -> None:
kwargs.setdefault("timeout", DEFAULT_TIMEOUT)
kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS)
kwargs.setdefault("follow_redirects", True)

super().__init__(**kwargs)


if TYPE_CHECKING:
DefaultAsyncHttpxClient = httpx.AsyncClient
"""An alias to `httpx.AsyncClient` that provides the same defaults that this SDK
Expand All @@ -1292,8 +1310,12 @@ def __init__(self, **kwargs: Any) -> None:
This is useful because overriding the `http_client` with your own instance of
`httpx.AsyncClient` will result in httpx's defaults being used, not ours.
"""

DefaultAioHttpClient = httpx.AsyncClient
"""An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`."""
else:
DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient
DefaultAioHttpClient = _DefaultAioHttpClient


class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):
Expand Down
2 changes: 1 addition & 1 deletion src/retell/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "retell"
__version__ = "4.36.0" # x-release-please-version
__version__ = "4.37.0" # x-release-please-version
Loading
Loading