OpenAI chatkit backend support for Google ADK
Project description
OpenAI chatkit support for Google ADK
This repository provides the backend support for openai/chatkit-js (https://github.com/openai/chatkit-js) for Google ADK based agentic applications.
It uses and extends openai/chatkit-python (https://github.com/openai/chatkit-python) by providing
ADKStorethat wrapsBaseSessionService- A function (
stream_agent_response) that translate ADK events into chatkit events - Provides support to render
widgets- See examples/backend/src/backend/agents/facts/_tools.py::get_weather
- Provides support for making calls to client tools.
- Client tools typically run in browser
- See examples/backend/src/backend/agents/facts/_tools.py::switch_theme
TODO:
- Support for attachments / artifacts
Install
uv add adk-chatkit
Running examples
Make sure you open this repository in vscode devcontainer and all dependencies will be setup for you
# At the root of the repository
# fill in your configuration / settings
cp .env.example .env
There is one backend and one frontend that hosts 4 agents (chatkit servers) and their corresponding user interface.
# Run the backend
uv run poe run-example-backend
# Run the frontend
uv run poe run-example-frontend
Usage
See examples for full usage
from adk_chatkit import ADKAgentContext, ADKContext, ADKStore, ChatkitRunConfig, stream_agent_response
class FactsChatkitServer(ChatKitServer[ADKContext]):
def __init__(
self,
store: ADKStore,
runner_manager: RunnerManager,
settings: Settings,
) -> None:
super().__init__(store)
agent = _make_facts_agent(settings)
self._runner = runner_manager.add_runner(settings.FACTS_APP_NAME, agent)
async def respond(
self,
thread: ThreadMetadata,
item: UserMessageItem | None,
context: ADKContext,
) -> AsyncIterator[ThreadStreamEvent]:
if item is None:
return
if _is_tool_completion_item(item):
return
message_text = _user_message_text(item)
if not message_text:
return
agent_context = ADKAgentContext(
app_name=context.app_name,
user_id=context.user_id,
thread=thread,
)
event_stream = self._runner.run_async(
user_id=context.user_id,
session_id=thread.id,
new_message=content,
run_config=ChatkitRunConfig(streaming_mode=StreamingMode.SSE, context=agent_context),
)
async for event in stream_agent_response(agent_context, event_stream):
yield event
Examples applications
There are 4 example applications (3 are ported from https://github.com/openai/openai-chatkit-advanced-samples)
Facts & Guide
- Shows Fact Recording
- Displays Weather using Widget
- Theme Switching
Customer Support
- Airline Reservation Management
- Change Seat
- Add bags
http://localhost:5171/customer-support
Knowledge Assistant
- Answers questions based on files and vector store
- Shows files and citations
http://localhost:5171/knowledge
Widget Gallery
- Shows various widgets and how to process actions
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file adk_chatkit-0.0.6.tar.gz.
File metadata
- Download URL: adk_chatkit-0.0.6.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
22ec626539629e26f00da31be7134e2e251f992aa96dfc2b6ae92b2760e5a0c2
|
|
| MD5 |
fb9ec5b4888b5added126c2a07929617
|
|
| BLAKE2b-256 |
f59e131dc9520aca8528aa63c850cc9a9a2d6a0a61f97a9f0306aae4cbea27d2
|
Provenance
The following attestation bundles were made for adk_chatkit-0.0.6.tar.gz:
Publisher:
publish.yaml on ksachdeva/adk-chatkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adk_chatkit-0.0.6.tar.gz -
Subject digest:
22ec626539629e26f00da31be7134e2e251f992aa96dfc2b6ae92b2760e5a0c2 - Sigstore transparency entry: 687844569
- Sigstore integration time:
-
Permalink:
ksachdeva/adk-chatkit@bb050a3c1b1b13d2b9cff8b1b8413ef7b477eb38 -
Branch / Tag:
refs/tags/0.0.6 - Owner: https://github.com/ksachdeva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@bb050a3c1b1b13d2b9cff8b1b8413ef7b477eb38 -
Trigger Event:
release
-
Statement type:
File details
Details for the file adk_chatkit-0.0.6-py3-none-any.whl.
File metadata
- Download URL: adk_chatkit-0.0.6-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b77ff96c77356c09f39ed12289608da8c2924cbcac7bfac476b6309773d07414
|
|
| MD5 |
8a9f1ffbfd7c620c576f76cd0cdc8424
|
|
| BLAKE2b-256 |
44310db807060066e80c70d6c9033140d13d0f547fa1b537a9721d1169da54bf
|
Provenance
The following attestation bundles were made for adk_chatkit-0.0.6-py3-none-any.whl:
Publisher:
publish.yaml on ksachdeva/adk-chatkit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
adk_chatkit-0.0.6-py3-none-any.whl -
Subject digest:
b77ff96c77356c09f39ed12289608da8c2924cbcac7bfac476b6309773d07414 - Sigstore transparency entry: 687844598
- Sigstore integration time:
-
Permalink:
ksachdeva/adk-chatkit@bb050a3c1b1b13d2b9cff8b1b8413ef7b477eb38 -
Branch / Tag:
refs/tags/0.0.6 - Owner: https://github.com/ksachdeva
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@bb050a3c1b1b13d2b9cff8b1b8413ef7b477eb38 -
Trigger Event:
release
-
Statement type: