Skip to content

livekit-api: thread and database clients - #930

Open
theomonnom wants to merge 10 commits into
mainfrom
theo/thread-database-clients
Open

theomonnom wants to merge 10 commits into
mainfrom
theo/thread-database-clients

Conversation

@theomonnom

@theomonnom theomonnom commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

Adds LiveKitAPI.threads and LiveKitAPI.databases (agent threads and agent databases on the LiveKit Cloud Public API), mirroring livekit/rust-sdks#1379.

from livekit import api

async with api.LiveKitAPI() as lkapi:
    thread = await lkapi.threads.create_thread(api.CreateThreadRequest(scope="user_42"))
    items = await lkapi.threads.get_thread_items(api.GetThreadItemsRequest(thread_id=thread.thread_id))
    await lkapi.threads.delete_thread(thread_id=thread.thread_id)

    dbs = await lkapi.databases.list_databases(api.ListDatabasesRequest())

Errors are the same ServerError as the other services. Twirp and Public API services now share one BaseService, and the error types moved to livekit.api.errors.

livekit/api/_generated/ is generated by livekit-api/public-api/generate.sh from the vendored openapi.yaml (OpenAPI Generator, aiohttp). The spec is from public-api-server@e273831, since livekit/public-api-server#150 hid these operations.

…se clients

Generate agent/livekit_agent_thread.proto (AgentThread, AgentTask) at the
current protocol pin. Add LiveKitAPI.threads and LiveKitAPI.databases, served
by the LiveKit Cloud Public API. The HTTP layer is generated with OpenAPI
Generator (python, asyncio) from the vendored spec in livekit-api/public-api;
run generate.sh there to re-vendor and regenerate.
@theomonnom
theomonnom marked this pull request as ready for review November 8, 2026 22:23
devin-ai-integration[bot]

This comment was marked as resolved.

@devin-ai-integration devin-ai-integration Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

Devin Review found 1 new potential issue.

1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review


async def _call(
self,
*,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Negative page sizes break list requests

For a negative list limit or page_size, _call sends that value instead of leaving the page size unset. The server receives an invalid page.pageSize, so the list request fails rather than using its default size.

Learn more

The four list methods pass protobuf integer page sizes through list, which forwards them as page_page_size to _call. The filter omits zero but preserves negative sizes, while the earlier page_size helper omitted every nonpositive size. The generated list operations serialize any present integer into page.pageSize, so a negative size reaches the server.

Example: With AgentThread.ListRequest(limit=-1), list_threads now sends page.pageSize=-1. Previously it omitted page.pageSize, letting the server apply its default page size.

Recommended fix: Normalize page_page_size in PublicApiClient.list with limit if limit > 0 else None, while preserving _call filtering for optional strings and zero-valued fields.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

devin-ai-integration[bot]

This comment was marked as resolved.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant