LAP  by Lap-Platform

Agent API specification compiler for enhanced LLM accuracy

Created 3 months ago
320 stars

Top 84.6% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

Lap-Platform/LAP addresses the critical issue of LLM agents hallucinating API calls due to incomplete or overly verbose specifications. It provides a compiler that transforms standard API definitions (OpenAPI, GraphQL, etc.) into a highly compressed, "agent-native" format. This significantly boosts agent accuracy in API interaction, reduces token consumption for cost savings, and accelerates inference times, making LLM-powered API integration more reliable and efficient.

How It Works

LAP employs a multi-stage compilation process that semantically compresses API specifications. It strips structural YAML overhead, replaces nested structures with a flat @directive grammar, compresses type declarations (e.g., type: string, format: uuid to str(uuid)), eliminates redundancy, and optionally removes descriptions in "lean mode" for further token reduction. This purpose-built compiler preserves all API details while achieving substantial size reductions, enabling agents to process and utilize API contracts more effectively.

Quick Start & Requirements

  • IDE Setup: Run npx @lap-platform/lapsh init for Claude Code, Cursor, or Codex.
  • Global Install: npm install -g @lap-platform/lapsh or pip install lapsh.
  • Dependencies: Node.js and npm/pip are required. Specific IDEs are supported.
  • Resources: Links to Website, Registry, Benchmarks, and Docs are provided.

Highlighted Details

  • Registry: Access 1500+ pre-compiled API specs via lap.sh.
  • Compression: Achieves median 5.2x compression on OpenAPI specs (up to 39.6x), resulting in 35% cost and 29% speed improvements.
  • Typed Contracts: Enforces strict types and enums (e.g., enum(succeeded|pending|failed)) to prevent agent hallucinations.
  • Format Support: Compiles from OpenAPI, GraphQL, AsyncAPI, Protobuf, Postman, and Smithy.
  • Integrations: Supports LangChain, Context Hub, and provides Python/TypeScript SDKs.

Maintenance & Community

The project includes issue trackers for bug reports and feature requests. Continuous integration is configured for Python 3.11/3.12 and Node 18/20. No explicit community channels like Discord or Slack are listed.

Licensing & Compatibility

The project is licensed under the Apache 2.0 license, which permits commercial use and integration into closed-source projects.

Limitations & Caveats

Codex agent hooks are currently experimental. While descriptions are stripped in "lean mode" to reduce token count, this relies on LLMs inferring meaning from well-named parameters, which might be a consideration for highly complex or poorly documented APIs.

Health Check
Last Commit

1 month ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
99 stars in the last 30 days

Explore Similar Projects

Starred by Yiran Wu Yiran Wu(Coauthor of AutoGen) and Eric Zhu Eric Zhu(Coauthor of AutoGen; Research Scientist at Microsoft Research).

PocketFlow by The-Pocket

0.3%
11k
Minimalist LLM framework for agentic coding
Created 1 year ago
Updated 1 month ago
Feedback? Help us improve.