Python SDK
The eGain API client SDK for Python offers a modern, type-safe interface for integrating with eGain’s Knowledge Portal Manager, AI Services, and Ingestion APIs.
License
The following licenses are required to use the SDK:
- If the user is an agent, then the Knowledge + AI license is required.
- If the user is a customer, the Self-Service and Advanced Self-Service licenses must be available.
SDK Installation
The SDK can be installed with uv, pip, or poetry package managers.
uv
uv add egain-api-python
PIP
pip install egain-api-python
Poetry
poetry add egain-api-python
SDK Example Usage
Example
# Synchronous Example
from egain_api_python import Egain
import os
with Egain(
access_token=os.getenv("EGAIN_ACCESS_TOKEN", ""),
) as egain:
res = egain.aiservices.retrieve.retrieve_chunks(q="fair lending", portal_id="PROD-1000", filter_user_profile_id="PROD-3210", language="en-US", filter_tags={
"PROD-1234": [
"PROD-2000",
"PROD-2003",
],
"PROD-2005": [
"PROD-2007",
],
}, channel={
"name": "Eight Bank Website",
})
# Handle response
print(res)