BiSheng LLM Application DevOps Platform

repository·main·Indexed 11 days ago

https://github.com/dataelement/bisheng

An open-source LLM application DevOps platform for enterprises featuring workflow orchestration, RAG, and multi-agent collaboration. Built with FastAPI, React, and LangGraph, it utilizes a Domain-Driven Design (DDD) architecture and supports advanced capabilities like Agent Guidance Language (AGL), Model Context Protocol (MCP) integration, and ReBAC-based permission management.

Tokens
399.2K
Snippets
800
Records
1.7K
Agent score
96%

What's inside BiSheng

  1. Overview of v2.5.1 Tenant Tree Architecture

    main

    Version 2.5.1 introduces a transition from a flat multi-tenant model to a Tenant Tree Architecture. This architecture is specifically designed for private deployment scenarios within large organizations (e.g., parent companies and their subsidiaries).

    Key architectural shifts include:

    • Hierarchical Structure: Moving from flat tenants to a tree-based model.
    • Simplified Data Model: Removal of tenant_path, level, and tenant_kind in favor of a streamlined model.
    • Root Tenant Constraints: The Root tenant is automatically created and is immutable (cannot be deleted or disabled).
    • Isolation Strategies: Enhanced tenant isolation for LLM resources and shared storage.
  2. Overview of BiSheng Architecture

    main

    BiSheng (v2.5.0+) is an open-source LLM application DevOps platform designed for enterprises. It is built using a stack of FastAPI, React, and LangGraph. The platform utilizes a Domain-Driven Design (DDD) architecture organized into over 15 domain modules.

    Key capabilities include:

    • Workflow orchestration
    • Knowledge Base / RAG (Retrieval-Augmented Generation)
    • Multi-Agent collaboration (Linsight)
    • MCP (Model Context Protocol) integration
    • Model evaluation and fine-tuning
    • Multi-tenant isolation
  3. Overview of bisheng-gateway

    main

    The bisheng-gateway is a commercial extension suite for BiSheng. It acts as a Java-based gateway layer deployed between the frontend and the backend. Its primary responsibilities include:

    • SSO/OAuth Unified Authentication: Managing single sign-on and OAuth2 flows.
    • Content Security Review: Filtering sensitive words in requests and responses.
    • Traffic Control: Implementing rate limiting and online session counting.
    • API Reverse Proxy: Routing requests to the BiSheng backend.

    It is an independent Java project with its own database tables (prefixed with gt_*) and configuration, communicating with the BiSheng backend via HTTP.

  4. What is BISHENG?

    main

    BISHENG is an open-source LLM (Large Language Model) application development platform designed specifically for enterprise scenarios. It provides a framework for building complex AI applications, including document auditing, report generation, multi-agent collaboration, and unstructured data governance.

    Key capabilities include:

    • BISHENG Workflow: A complete application orchestration framework supporting loops, parallel execution, batch processing, and conditional logic. It features Human in the loop capabilities, allowing users to intervene and provide feedback during workflow execution.
    • AGL (Agent Guidance Language): A framework to integrate domain expert preferences and business logic into AI agents.
    • High-Precision Document Parsing: Specialized models for OCR (printed, handwritten, rare characters), table recognition, layout analysis, and seal detection.
    • Enterprise Features: Role-based access control (RBAC), user group management, SSO/LDAP support, and high-availability deployment options.
  5. Core Features of BISHENG

    main

    BISHENG is an open LLM application DevOps platform designed for enterprise scenarios. Key features include:

    • Lingsight: A general-purpose agent using the AGL (Agent Guidance Language) framework to embed domain expertise and business logic into AI tasks.
    • BISHENG Workflow: An orchestration framework that supports:
      • Independent Orchestration: Executes various tasks within a single framework.
      • Human in the loop: Allows user intervention and feedback during workflow execution.
      • Advanced Logic: Supports loops, parallelism, batch processing, and conditional logic via a visual flowchart interface.
    • Enterprise-grade Capabilities: Includes RBAC, user group management, SSO/LDAP, security reviews, traffic control, and high availability deployment.
    • High-Precision Document Parsing: Specialized models for printed text, handwriting, rare characters, table recognition, layout analysis, and seal recognition.
    • Community Sharing: An open repository for enterprise application best practices and use cases.
  6. Navigate BiSheng documentation

    main

    Use the following directory structure to locate specific types of information within the BiSheng repository:

    • Development Standards: Found in the root directory (e.g., constitution.md, SDD-Guide.md).
    • System Architecture: Detailed subsystem documentation is located in the architecture/ directory.
    • Feature Documentation: Organized by version and feature ID in the ../features/ directory (e.g., v{X.Y.Z}/{NNN}-{name}/).
    • API Reference: Interface documentation for filelib retrieval, knowledge spaces, and knowledge bases is in the api/ directory.
    • Deployment: Private/On-premise deployment guides are in the 私有化部署/ directory.
    • Observability: Metric and log contracts (BS_METRIC) are in the observability/ directory.
  7. v2.6.0 Feature List and Status

    main

    The v2.6.0 release aims to unify cross-module product capabilities, such as the Approval Center.

    Key features in this version include:

    • F025: approval-center-unification: Unification of the approval center (Priority: P0).
    • F028: conversation-export-import: Ability to export workspace conversation answers and import them into knowledge spaces (Priority: P0).
  8. Overview of the ReBAC Permission Engine

    main
    The ReBAC (Relationship-Based Access Control) engine is a core infrastructure component introduced in v2.5.0. It integrates OpenFGA as the primary engine to provide unified permission checks, resource authorization, caching, and write-compensation capabilities. It is designed to handle complex relationships between users, departments, groups, and various resource types using a static Authorization Model DSL.
  9. Overview of the Linsight Agent Framework

    main

    Linsight (灵思) is BiSheng's built-in autonomous task execution framework designed for complex scenarios requiring multi-step reasoning, tool calling, and human-in-the-loop interaction. It uses SOPs (Standard Operating Procedures) to decompose user requirements into structured task trees.

    Key features include:

    • SOP-driven execution: Decomposes tasks into structured steps.
    • MCP Integration: Supports Model Context Protocol for unified external tool access via SSE, Standard I/O, and Streamable HTTP.
    • Worker Architecture: Decoupled execution using a Redis-based FIFO queue and independent Worker processes.
    • Human-in-the-loop: Supports pausing execution to wait for user input and resuming via continue_task().
  10. Overview of Third-Party Organization Synchronization

    main

    BiSheng supports third-party organization synchronization (OrgSync) to automatically import department trees and employee information from platforms like Feishu, WeCom, or DingTalk.

    Key Capabilities:

    • Automated Management: Automatically creates departments, users, and membership relationships.
    • Permission Maintenance: Automatically maintains OpenFGA permission tuples via DepartmentChangeHandler.
    • Lifecycle Handling: Manages personnel changes (transfers, new hires) and departures (disabling accounts, cleaning permissions).
    • Execution Modes: Supports both manual triggers and scheduled synchronization via Cron expressions.
    • Architecture: Uses a Provider + Reconciler pattern. Providers fetch standardized data, while the Reconciler compares it with local data to generate change operations.
  11. Reference: ReBAC Permission Model Hierarchy

    main

    The ReBAC system uses a permission pyramid where higher-level roles inherit the capabilities of lower-level roles.

    Hierarchy:

    • owner: Can view + edit + manage + delete
    • manager: Can view + edit + manage
    • editor: Can view + edit
    • viewer: Can view

    Computed Relations:

    • can_manage is equivalent to manager and its parents.
    • can_edit is equivalent to editor and its parents.
    • can_read is equivalent to viewer and its parents.

    Deletion Logic (can_delete):

    • Top-level resources (knowledge_space, workflow, assistant, tool, channel, dashboard): Only the owner can delete.
    • Hierarchical resources (folder, knowledge_file): The owner OR anyone with can_manage from a parent can delete.
  12. How PermissionService handles authorization checks

    main

    The PermissionService.check method implements a five-level (L1-L5) verification pipeline to determine if a user has a specific relation to an object. This ensures high performance via caching and high availability via fallback mechanisms:

    1. L1 (Admin Bypass): If the login_user has admin privileges (is_admin()), returns True immediately.
    2. L2 (L2 Cache): Checks PermissionCache. If a cached result exists, returns it.
    3. L3 (FGA Engine): Calls FGAClient.check() to query the OpenFGA REST API.
    4. L4 (Owner Fallback): If the FGA check is inconclusive, it performs a database lookup on the resource's user_id to check for ownership.
    5. L5 (Fail-Closed): If all checks fail, it defaults to False to ensure security.

    Other key methods include:

    • list_accessible_ids(user_id, relation, object_type, login_user?): Returns a list of accessible IDs. Admins receive None (no filtering). Uses PermissionCache and FGAClient.list_objects().
    • authorize(object_type, object_id, grants, revokes?): Manages permissions by writing tuples. It expands department sub-trees via _expand_subject and invalidates relevant PermissionCache entries upon success.
    • get_permission_level(user_id, object_type, object_id): Returns the highest applicable permission level (e.g., ownercan_managecan_editcan_read) using FGAClient.batch_check().