Skip to main content
Glama

Lingua Universale

검증된 AI 에이전트 프로토콜을 위한 언어.

PyPI Tests License: Apache 2.0 Zero Dependencies VS Code Discord

브라우저에서 체험하기 -- 설치가 필요 없습니다. AI 에이전트 실시간 보기 -- 검증된 프로토콜에서 3개의 에이전트가 작동합니다.


문제점

AI 에이전트들은 서로 대화하지만, 그들이 규칙을 따르는지 보장할 방법이 없습니다. 잘못된 발신자, 잘못된 메시지 순서, 누락된 단계 등은 운영 환경에서야 발견됩니다.

Lingua Universale(LU)은 AI 에이전트 대화를 위한 타입 체커입니다. 프로토콜을 정의하면 LU가 그 정확성을 증명하고, 런타임이 이를 강제합니다.

from cervellaswarm_lingua_universale import Protocol, ProtocolStep, MessageKind, SessionChecker, TaskRequest

# Define: who sends what, to whom, in what order
review = Protocol(name="Review", roles=("dev", "reviewer"), elements=(
    ProtocolStep(sender="dev", receiver="reviewer", message_kind=MessageKind.TASK_REQUEST),
    ProtocolStep(sender="reviewer", receiver="dev", message_kind=MessageKind.TASK_RESULT),
))

checker = SessionChecker(review)
checker.send("dev", "reviewer", TaskRequest(task_id="1", description="Review auth"))  # OK
checker.send("dev", "reviewer", TaskRequest(task_id="2", description="Oops"))         # ProtocolViolation!
#                                                                                      ^^^ wrong turn: reviewer must send next

프로토콜에 따르면 검토자가 다음 차례여야 합니다. 런타임은 이를 차단합니다. 코드를 신뢰해서가 아니라, 세션 타입이 이를 불가능하게 만들기 때문입니다.


Related MCP server: correctover-mcp-server

설치

pip install cervellaswarm-lingua-universale

또는 먼저 체험해 보세요: 플레이그라운드 (Pyodide를 통해 브라우저에서 실행).


프로토콜 작성

protocol DelegateTask:
    roles: supervisor, worker, validator

    supervisor asks worker to execute analysis
    worker returns result to supervisor
    supervisor asks validator to verify result

    when validator decides:
        pass:
            validator returns approval to supervisor
        fail:
            validator sends feedback to supervisor

    properties:
        always terminates
        no deadlock
        no deletion
        all roles participate

그런 다음 검증하세요:

lu verify delegate_task.lu
  [1/4] always_terminates  ... PROVED
  [2/4] no_deadlock        ... PROVED
  [3/4] no_deletion        ... PROVED
  [4/4] all_roles_participate ... PROVED

  All 4 properties PASSED.

수학적 증명입니다. 오늘 통과하고 내일 실패하는 테스트가 아닙니다.


제공 기능

기능

설명

전체 컴파일러

토크나이저, 파서(64개 규칙), AST, 계약 체커, Python 코드 생성

9가지 검증 속성

always_terminates, no_deadlock, no_deletion, role_exclusive 등

20개 표준 라이브러리 프로토콜

AI/ML, 비즈니스, 통신, 데이터, 보안 등 즉시 사용 가능

린터 + 포맷터

lu lint (10개 규칙) + lu fmt (gofmt와 같은 제로 설정)

LSP 서버

진단, 호버, 자동 완성, 정의로 이동, 포맷팅

VS Code 확장 프로그램

마켓플레이스에서 설치

대화형 채팅

lu chat -- 대화를 통해 프로토콜 구축 (영어, 이탈리아어, 포르투갈어)

브라우저 플레이그라운드

지금 체험하기 -- 확인, 린트, 실행, 채팅

Lean 4 브리지

수학적 증명 생성 및 검증

REPL

대화형 탐색을 위한 lu repl

프로젝트 스캐폴딩

20개의 검증된 템플릿에서 lu init --template rag_pipeline

37개 모듈. 3979개 테스트. 외부 의존성 제로. 순수 Python 표준 라이브러리.


CLI

lu check file.lu          # Parse and compile
lu verify file.lu         # Formal property verification
lu run file.lu            # Execute
lu lint file.lu           # 10 style and correctness rules
lu fmt file.lu            # Zero-config auto-formatter
lu chat --lang en         # Build a protocol conversationally
lu demo --lang it         # See the La Nonna demo
lu init --template NAME   # Scaffold from stdlib templates
lu visualize file.lu      # Generate Mermaid sequence diagram
lu mcp-audit --manifest t.json  # Audit MCP server protocols
lu repl                   # Interactive REPL
lu lsp                    # Start LSP server

CI 통합

GitHub Actions 워크플로우에 프로토콜 검증을 추가하세요:

# .github/workflows/lu-check.yml
on:
  push:
    paths: ["**/*.lu"]

jobs:
  lu-check:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v6
        with:
          python-version: "3.11"
      - run: pip install cervellaswarm-lingua-universale
      - run: lu lint protocols/
      - run: lu verify protocols/

위반 시 종료 코드가 0이 아니므로 모든 CI 시스템과 호환됩니다.


작동 원리

LU는 다자간 세션 타입(Honda, Yoshida, Carbone -- POPL 2008)을 기반으로 합니다. 세션 타입은 통신 프로토콜을 타입으로 설명합니다. 두 프로세스가 동일한 세션 타입을 따르면 데드락이 발생하지 않고, 메시지가 잘못된 순서로 도착하지 않으며, 대화가 항상 종료됩니다.

파이프라인:

.lu source → Tokenizer → Parser → AST → Spec Checker → Lean 4 Proofs → Python Codegen
                                           ↓
                                    PROVED or VIOLATED

LU는 기존 AI 에이전트 프레임워크를 대체하지 않습니다. 더 안전하게 만들어 줄 뿐입니다. JavaScript를 위한 TypeScript처럼, 기존 도구는 유지하면서 보증을 추가하는 것입니다.


예제

LU 디버거 -- 실시간 웹 앱: 3개의 AI 에이전트(고객, 창고, 결제)가 검증된 OrderProcessing 프로토콜로 통신합니다. "Break"를 클릭하여 실시간으로 차단되는 프로토콜 위반을 확인하세요. 소스 코드.

examples/ 디렉토리를 확인하세요:

또는 대화형 Colab 노트북을 시도해 보세요 -- 2분 소요, 설정 불필요.


CervellaSwarm의 추가 정보

Lingua Universale은 CervellaSwarm의 핵심 프로젝트입니다. 또한 다음 Python 패키지들을 게시하고 있습니다:

패키지

기능

code-intelligence

AST 기반 코드 이해 (tree-sitter, PageRank)

agent-hooks

Claude Code 에이전트를 위한 라이프사이클 훅

agent-templates

에이전트 정의 템플릿 및 팀 구성

task-orchestration

결정론적 작업 라우팅 및 검증

spawn-workers

다중 에이전트 프로세스 관리

session-memory

대화 간 지속적인 세션 컨텍스트

event-store

불변 이벤트 로깅 및 감사 추적

quality-gates

자동화된 품질 검사 및 점수 산정

모두 Apache 2.0 라이선스, Python 3.10+ 지원, 테스트 완료 및 문서화되어 있습니다.


기여

기여를 환영합니다! 가이드라인은 CONTRIBUTING.md를 참조하세요.


라이선스

Apache License 2.0 -- LICENSE를 참조하세요.

Copyright 2025-2026 CervellaSwarm Contributors.


Lingua Universale -- AI 에이전트를 위한 검증된 프로토콜.

플레이그라운드 | LU 디버거 | PyPI | VS Code | 블로그 | Colab 데모

Available Tools

4 tools
lu_check_propertiesA

Verify the formal safety properties declared in a .lu protocol.

Runs the static property checker (Layer 1) on all protocols found in
the source. Optionally, if Lean 4 is installed, also runs formal
verification (Layer 2).

Args:
    protocol_text: Full .lu protocol definition text including a
        "properties:" block, e.g.:
        "    properties:\n"
        "        always terminates\n"
        "        no deadlock\n"
        "        all roles participate\n"

Returns:
    JSON string with:
      ok (bool), protocols (list of protocol results), summary (dict).
      Each protocol result has: protocol_name, all_passed, results (list).
      Each result has: kind, verdict, evidence, params.

Inputs: protocol_text (required). Returns: result

lu_list_templatesA

List available Lingua Universale standard library protocol templates.

The standard library contains 20 verified protocols across 5 categories:
communication, data, business, ai_ml, security.

Args:
    category: Optional filter. One of: communication, data, business,
        ai_ml, security. Leave empty to list all templates.

Returns:
    JSON string with:
      ok (bool), templates (list), category_filter (str), total (int).
      Each template has: name, category, description.

Inputs: category. Returns: result

lu_load_protocolA

Parse a Lingua Universale (.lu) protocol definition.

Accepts the full text of a .lu file and returns the parsed protocol
structure: name, roles, steps, choices, and declared properties.

Args:
    protocol_text: Content of a .lu file, e.g.:
        "protocol RequestResponse:\n"
        "    roles: client, server\n"
        "    client asks server to process request\n"
        "    server returns response to client\n"
        "    properties:\n"
        "        always terminates\n"
        "        no deadlock\n"

Returns:
    JSON string with keys:
      ok (bool), protocol_name (str), roles (list[str]),
      steps (list), properties (list), error (str on failure).

Inputs: protocol_text (required). Returns: result

lu_verify_messageA

Verify whether a message is valid in the context of an ongoing session.

Replays the existing message history against the protocol, then checks
whether next_message is the expected next step.

Args:
    protocol_text: Full .lu protocol definition text.
    messages: List of already-sent messages, each a dict with keys:
        sender (str), receiver (str), action (str).
        Actions are LU action names: "asks", "returns", "sends",
        "proposes", "tells". These match the verbs in .lu source files.
    next_message: The message to validate, same format as above.

Returns:
    JSON string:
      On success: {"valid": true, "step": N, "next_expected": "..."}
      On violation: {"valid": false, "violation": "...", "expected": "...", "got": "..."}
      On error: {"valid": false, "error": "..."}

Example:
    protocol_text = "protocol Ping:\n    roles: a, b\n    a asks b to ping\n    b returns pong to a\n    properties:\n        always terminates\n"
    messages = [{"sender": "a", "receiver": "b", "action": "asks"}]
    next_message = {"sender": "b", "receiver": "a", "action": "returns"}
    # Returns: {"valid": true, ...}

Inputs: protocol_text (required), messages (required), next_message (required). Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 4 tools

    Disambiguation5/5

    Each tool has a distinct purpose: parsing, message verification, property checking, and template listing. No overlap in functionality; agents can easily select the right tool for their task.

    Naming Consistency4/5

    Names follow a consistent 'lu_' prefix and verb_noun pattern (load_protocol, verify_message, check_properties, list_templates). Minor deviation: 'load_protocol' could be 'parse_protocol' but still clear and consistent.

    Tool Count4/5

    With only 4 tools, the server is slightly under the typical 3-15 range, but this is appropriate for a niche protocol validation domain. The tools cover the core needs without bloat.

    Completeness3/5

    The server covers parsing, verification, property checking, and template listing, but misses a 'simulate' or 'validate full session' tool. Gaps exist for agents needing end-to-end protocol simulation or editing, but core workflows are supported.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Integrates the Quint formal specification language into LLM workflows for accessible formal verification. It provides tools for type-checking, random simulation, exhaustive model checking, and syntax documentation.
      6
      2
      PolyForm Noncommercial 1.0.0
    • -
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to safely run Pact 5 REPL tests, scan modules for critical language traps, estimate gas, generate contracts, and invoke formal verification via a standalone prover plugin.
      -
    • A
      license
      C
      quality
      B
      maintenance
      Enables AI assistants and autonomous agents to intercept arithmetic and algebraic hallucinations via exact rational verification, seal multi-step reasoning chains with SHA-256 Merkle commitments, and optionally bridge deep verification to a remote sovereign enclave. It also supports BFT epistemic consensus across multi-agent proposals and tamper-evident session sealing.
      15
      MIT