kosong  by MoonshotAI

LLM abstraction layer for AI agent applications

Created 2 months ago
472 stars

Top 64.6% on SourcePulse

GitHubView on GitHub
Project Summary

Summary

Kosong is an LLM abstraction layer designed to simplify the development of modern AI agent applications. It addresses the complexity of integrating various Large Language Models and managing asynchronous operations by providing a unified interface for message structures, tool orchestration, and pluggable chat providers, thereby helping developers avoid vendor lock-in and build agents more efficiently.

How It Works

The core of Kosong lies in its design for unifying disparate LLM interactions. It achieves this through pluggable chat providers, allowing seamless switching between different LLM services. Asynchronous tool orchestration is a key feature, enabling complex agent workflows that can call external tools and functions. This approach simplifies agent development by abstracting away provider-specific details and managing the asynchronous nature of LLM interactions and tool execution.

Quick Start & Requirements

Kosong requires Python 3.13 or higher and recommends the uv package manager. Installation involves initializing a project with uv init --python 3.13 and then adding Kosong as a dependency using uv add kosong. Users will need API keys for the chat providers they intend to use, such as Kimi. A built-in demo agent can be run locally by setting environment variables for KIMI_BASE_URL and KIMI_API_KEY, then executing uv run python -m kosong kimi --with-bash.

Highlighted Details

  • Supports standard chat completions and streaming output via an on_message_part callback.
  • Features asynchronous tool calling capabilities using kosong.step, which integrates with Pydantic models for defining tool parameters and return types.
  • Designed with pluggable chat providers, exemplified by the Kimi provider, allowing for flexible LLM integration.

Maintenance & Community

No specific details regarding maintainers, community channels (like Discord/Slack), or project roadmap were provided in the README excerpt.

Licensing & Compatibility

The license type and any compatibility notes for commercial use or closed-source linking were not specified in the provided README excerpt.

Limitations & Caveats

A significant requirement is the strict dependency on Python 3.13+, which may limit adoption for projects on older Python versions. The functionality relies on external API keys for LLM providers, and setup requires configuring these credentials.

Health Check
Last Commit

1 hour ago

Responsiveness

Inactive

Pull Requests (30d)
29
Issues (30d)
4
Star History
443 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.