Skip to content

Python SDK

The Python SDK wraps the Context API so you can query Fabric from any Python agent or backend without hand-rolling HTTP.

Terminal window
pip install wexa
agent.py
from wexa import Wexa
wexa = Wexa(api_key="<YOUR_API_KEY>")
context = wexa.context.query(
workspace="ws_<your_project>",
query="top accounts at churn risk",
)
print(context.entities)
  • api_key — a project-scoped fab_sk_… key. Generate one in Simple Mode. Prefer reading it from the environment or your secret manager rather than hardcoding it.
  • workspace — your workspace ID (ws_<your_project>); it pins the call’s scope.

context.query(...) returns the ranked entities, relationships, and facts that ground the query — the same connected neighborhood the MCP query-context tool returns — along with a lifecycle_id for tracing and audit.

Option Purpose
api_key Project-scoped credential (fab_sk_…).
Base URL Defaults to the managed cloud; point it at your deployment’s apiBaseUrl (from connection-info) for on-prem / air-gapped.