Skip to main content

Add your description here

Project description

LSAP: Language Server Agent Protocol

License Protocol Version

LSAP (Language Server Agent Protocol) transforms low-level LSP capabilities into high-level, Agent-Native cognitive tools, empowering Coding Agents with Repository-Scale Intelligence.

As an Orchestration Layer, LSAP composes atomic LSP operations into semantic interfaces. This aligns with Agent cognitive logic, allowing them to focus on high-level "intent realization" rather than tedious "editor operations."

Core Concept: Atomic Capabilities vs. Cognitive Capabilities

The core difference of LSAP lies in how it defines "capabilities." LSP is designed for editors, providing Atomic operations; whereas LSAP is designed for Agents, providing Cognitive capabilities.

  • LSP (Editor Perspective - Atomic):
    • Editors require very low-level instructions: textDocument/definition (jump), textDocument/hover (hover), textDocument/documentSymbol (outline).
    • The Agent's Dilemma: If an Agent uses LSP directly, it needs to execute a dozen interactions sequentially like a script (open file -> calculate offset -> request definition -> parse URI -> read file -> extract snippet) just to get a useful context.
  • LSAP (Agent Perspective - Cognitive):
    • LSAP encapsulates the complex chain of atomic operations above into a single semantic instruction.
    • Example: A single request to "Find all references" triggers background execution of symbol localization, reference search, and context extraction, returning a consolidated Markdown Report.
sequenceDiagram
    participant Agent as 🤖 Agent
    participant LSAP as 🧠 LSAP Layer
    participant LSP as 🔧 Language Server

    Note left of Agent: Goal: Find all references of "User"

    Agent->>LSAP: 1. Semantic Request (Locate + References)

    rect rgb(245, 245, 245)
        Note right of LSAP: ⚡️ Auto Orchestration
        LSAP->>LSAP: Parse Semantic Anchor (Fuzzy Match)
        LSAP->>LSP: textDocument/hover (Confirm Symbol Info)
        LSAP->>LSP: textDocument/references (Get Reference List)
        LSP-->>LSAP: Return List<Location>

        loop For each reference point
            LSAP->>LSP: textDocument/documentSymbol (Identify Function/Class)
            LSAP->>LSAP: Read Surrounding Code (Context Lines)
        end
    end

    LSAP-->>Agent: 2. Structured Markdown (Callers + Code Context)

Interaction Example

LSAP's interaction design strictly follows the Markdown-First principle: input expresses intent, and output provides refined knowledge.

Request: Semantic Search (Demonstrating Composed Capabilities)

The Agent only needs to issue a high-level command without worrying about underlying row/column calculations or file reading:

// Intent: Find all usages of 'DateUtil.format_date' to refactor it
{
  "locate": {
    "file_path": "src/utils.py",
    // we can find the def ...
    "find": "def format_date<|>", // use `<|>` to identify the exact position
    // ... or we can use locate
    "locate": "DateUtil.format_date", // use hierarchical path to identify symbol
  },
  "mode": "references",
  "max_items": 10,
}

Response: Structured Knowledge

LSAP aggregates the results of references (locations), documentSymbol (caller context), and read (code snippets):

# References Found

Total references: 45 | Showing: 2

### `src/ui/header.py`:28

In `Header.render` (`Method`)

```python
formatted = format_date(user.last_login)
```

### `src/api/views.py`:42

In `UserDetail.get` (`Method`)

```python
return {"date": format_date(obj.created_at)}
```

I'm Not Convinced...

"LSAP Just Replicates LSP—What's Special?"

While LSP provides atomic operations, LSAP offers composed capabilities.

For instance, the Relation API finds call paths between functions in a single request (handling traversal, cycles, and formatting), a task requiring complex orchestration in raw LSP. Similarly, the Unified Hierarchy API delivers unified graph representations optimized for agents.

LSAP centralizes these patterns, preventing agents from wasting tokens on orchestration and enabling advanced capabilities like architectural and impact analysis.

"This Adds Complexity"

LSAP centralizes complexity. Instead of every Agent reimplementing LSP orchestration logic, LSAP provides a shared, optimized layer for these common patterns.

Project Structure

  • docs/: Core protocol definitions and Schema documentation.
  • python/: Python SDK reference implementation.
  • typescript/: TypeScript type definitions and utility library.
  • web/: Protocol documentation site.

Alternatives

Claude Code

Claude Code have native LSP supports now - Well they don't

Serena

serena is a powerful coding agent toolkit providing semantic retrieval and editing capabilities.

Other Projects

Contributing

We welcome contributions! Please see our Contributing Guide for details on development workflows and design principles.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

lsap_sdk-0.1.0.tar.gz (24.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lsap_sdk-0.1.0-py3-none-any.whl (40.3 kB view details)

Uploaded Python 3

File details

Details for the file lsap_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: lsap_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 24.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lsap_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cb8b7372db46f312ca7c964589c5f687f8c120d320b8e9806943fa6961203df9
MD5 de1e34561844d739467a8ad6e1e74a19
BLAKE2b-256 369374a264d62580a4d3db8bbb17372d346afef9f9e788d22019fddf5cfeceab

See more details on using hashes here.

Provenance

The following attestation bundles were made for lsap_sdk-0.1.0.tar.gz:

Publisher: release.yml on lsp-client/LSAP

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file lsap_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: lsap_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 40.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for lsap_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6328314c1524e230ee443de3e1fb35e583989071d7a4de3739d3f33c1314b0da
MD5 b3828c6bf9b982294b908b272422f459
BLAKE2b-256 3bd87df2efda7c55226c5c7022d7489e6b9dbd8634191b055062af88480d3017

See more details on using hashes here.

Provenance

The following attestation bundles were made for lsap_sdk-0.1.0-py3-none-any.whl:

Publisher: release.yml on lsp-client/LSAP

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page