Skip to main content

Assistant Service Kit

Reusable Python package for building LangChain-based assistant services with FastAPI, auth, tenancy, tools, RAG, tracing, storage, and observability.

Install

Base runtime:

pip install assistant-service-kit

Provider-specific installs:

pip install "assistant-service-kit[rag,gemini]"
pip install "assistant-service-kit[rag,openai]"
pip install "assistant-service-kit[rag,anthropic]"

For local development from this package directory:

pip install -e ".[dev]"

Core Pieces

  • Assistant: simple facade for building a FastAPI assistant quickly.
  • AssistantDefinition: declares the assistant server contract.
  • AssistantEndpoints / EndpointPolicy: declares enabled routes, custom paths, names, global endpoint policy, and endpoint permissions.
  • AuthConnector: supports no-auth, user-only, trusted internal token, API key, and custom identity resolution.
  • LLMProviderRegistry: Gemini, OpenAI, Anthropic, and fake chat model providers.
  • EmbeddingProviderRegistry: Gemini, OpenAI, Anthropic, and fake embedding providers.
  • ApiClient / ApiClientConfig: reusable HTTP client for tools, including API key, bearer, forwarded token, and gateway-delegated token auth.
  • ToolRegistry / ToolPolicy: exposes and validates tools by tenant, user, roles, and limits.
  • SQLAlchemyTraceStore / InMemoryTraceStore: reusable chat trace persistence.
  • PostgresRagStore / VectorStoreConnector: reusable RAG storage and vector-store integration points.
  • create_assistant_sqlalchemy_models: standard SQLAlchemy trace and RAG models for the common case.
  • answer_with_langchain_agent: LangChain tool-calling orchestrator with observability metadata.

Minimal Example

from assistant_service_kit import (
    Assistant,
    AssistantEndpoints,
    DatabaseConfig,
    TenancyMode,
    create_sqlalchemy_database,
)

database = create_sqlalchemy_database(DatabaseConfig(debug=True, debug_url="sqlite:///:memory:"))

assistant = Assistant(
    name="demo",
    title="Demo Assistant",
    base_path="/api/assistant",
    tenancy=TenancyMode.NONE,
    prompt="Answer clearly.",
    endpoints=AssistantEndpoints(chat=False, conversations=False, messages=False, feedback=False),
)

assistant.with_no_auth()
assistant.with_llm(provider="fake", model="fake", extra={"response": "ok"})
assistant.with_database(database)

app = assistant.fastapi()

Declarative tools:

from pydantic import BaseModel
from assistant_service_kit import ApiClientConfig, ToolPolicy, ToolRegistry


class SearchArgs(BaseModel):
    query: str


tools = ToolRegistry()
tools.api_tool(
    name="search_data",
    description="Search tenant data.",
    args_schema=SearchArgs,
    policy=ToolPolicy(requires_tenant=True, requires_user=True, max_limit=10),
    client="data_api",
    method="GET",
    path="/internal/search/",
    params="payload",
)


assistant.with_api_client("data_api", ApiClientConfig(base_url="https://internal-api.example"))
assistant.with_tools(tools)

Use @tools.tool(...) when a tool needs custom Python logic instead of a direct API call.

For standard SQLAlchemy persistence:

from assistant_service_kit import DatabaseConfig, create_sqlalchemy_database

database = create_sqlalchemy_database(
    DatabaseConfig(
        debug=True,
        debug_url="sqlite:///./assistant.db",
        url="postgresql+psycopg2://user:pass@host/db",
    )
)

assistant.with_database(database)
assistant.with_rag(database, default_limit=4, max_limit=8, chunk_size=800, chunk_overlap=120)
app = assistant.fastapi()

For advanced integrations, call assistant.build() to get an AssistantDefinition, or build AssistantDefinition and connectors directly.

Status

The package is in alpha. APIs can change until the first stable release.

Metadata

Release files for assistant-service-kit 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for assistant-service-kit 0.6.0
File Size Uploaded Provenance
assistant_service_kit-0.6.0.tar.gz 33.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for assistant-service-kit 0.6.0
File Interpreter ABI Platform
assistant_service_kit-0.6.0-py3-none-any.whl Python 3 none any Details

Total release size: 71.5 kB

Release files / assistant_service_kit-0.6.0.tar.gz

Download URL assistant_service_kit-0.6.0.tar.gz
Size 33.0 kB
Tags Source
SHA-256 checksum
How to use checksums
928310d973d2d190f43254570e8db82f15459dbb434bbbe9427d8c159277177c
BLAKE2b-256 checksum
How to use checksums
2763f00d78926982fde293fd2d9e2fa881a7783a74b870874fd6902f1ac51f01
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Release files / assistant_service_kit-0.6.0-py3-none-any.whl

Download URL assistant_service_kit-0.6.0-py3-none-any.whl
Size 38.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eeaa0f8e11e9c9b994efa4f08f38db689ba2dbcc3633ed902b731de4833af3aa
BLAKE2b-256 checksum
How to use checksums
343d8f773f55f4a1ebbbf1dd9f6565263593b49dcd19c65925c201b734c7cd86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Security for assistant-service-kit 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page