{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Python SDK","llmstxt":{"hide":false,"sections":[{"title":"Table of contents","includeFiles":["**/*"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"python-sdk","__idx":0},"children":["Python SDK"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["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."]},{"$$mdtype":"Tag","name":"div","attributes":{"style":{"padding":"16px 0","marginBottom":"24px"}},"children":[{"$$mdtype":"Tag","name":"a","attributes":{"href":"https://github.com/eGain/egain-api-python","target":"_blank","rel":"noopener noreferrer","className":"github-card","style":{"display":"inline-flex","alignItems":"center","gap":"12px","padding":"12px 24px","border":"1px solid #d1d5db","borderRadius":"8px","backgroundColor":"#fff","color":"#374151","textDecoration":"none","fontSize":"14px","fontWeight":"500"}},"children":[{"$$mdtype":"Tag","name":"svg","attributes":{"width":"20","height":"20","fill":"currentColor","viewbox":"0 0 20 20","xmlns":"http://www.w3.org/2000/svg"},"children":[{"$$mdtype":"Tag","name":"path","attributes":{"fillRule":"evenodd","d":"M10 0C4.477 0 0 4.484 0 10.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.531 1.032 1.531 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0110 4.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.203 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.942.359.31.678.921.678 1.856 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0020 10.017C20 4.484 15.522 0 10 0z","clipRule":"evenodd"},"children":[]}]},"\n    View on GitHub\n  "]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"license","__idx":1},"children":["License"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The following licenses are required to use the SDK:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If the user is an agent, then the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Knowledge + AI"]}," license is required."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["If the user is a customer, the ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Self-Service"]}," and ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["Advanced Self-Service"]}," licenses must be available."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"sdk-installation","__idx":2},"children":["SDK Installation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The SDK can be installed with ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["uv"]},", ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["pip"]},", or ",{"$$mdtype":"Tag","name":"em","attributes":{},"children":["poetry"]}," package managers."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"uv","__idx":3},"children":["uv"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"uv add egain-api-python\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"pip","__idx":4},"children":["PIP"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"pip install egain-api-python\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"poetry","__idx":5},"children":["Poetry"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"poetry add egain-api-python\n","lang":"bash"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"sdk-example-usage","__idx":6},"children":["SDK Example Usage"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example","__idx":7},"children":["Example"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"# Synchronous Example\nfrom egain_api_python import Egain\nimport os\n\n\nwith Egain(\n    access_token=os.getenv(\"EGAIN_ACCESS_TOKEN\", \"\"),\n) as egain:\n\n    res = egain.aiservices.retrieve.retrieve_chunks(q=\"fair lending\", portal_id=\"PROD-1000\", filter_user_profile_id=\"PROD-3210\", language=\"en-US\", filter_tags={\n        \"PROD-1234\": [\n            \"PROD-2000\",\n            \"PROD-2003\",\n        ],\n        \"PROD-2005\": [\n            \"PROD-2007\",\n        ],\n    }, channel={\n        \"name\": \"Eight Bank Website\",\n    })\n\n    # Handle response\n    print(res)\n","lang":"python"},"children":[]}]},"headings":[{"value":"Python SDK","id":"python-sdk","depth":1},{"value":"License","id":"license","depth":3},{"value":"SDK Installation","id":"sdk-installation","depth":2},{"value":"uv","id":"uv","depth":3},{"value":"PIP","id":"pip","depth":3},{"value":"Poetry","id":"poetry","depth":3},{"value":"SDK Example Usage","id":"sdk-example-usage","depth":2},{"value":"Example","id":"example","depth":3}],"frontmatter":{"seo":{"title":"Python SDK"}},"lastModified":"2026-02-24T06:02:41.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/developer-portal/sdks/python/sdk","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}