Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.57 KB

index.md

File metadata and controls

55 lines (40 loc) · 1.57 KB

LiteSwarm

A lightweight, LLM-agnostic framework for building AI agents with dynamic agent switching. Supports 100+ language models through litellm.

Features

  • Lightweight Core: Minimal base implementation that's easy to understand and extend
  • LLM Agnostic: Support for OpenAI, Anthropic, Google, and many more through litellm
  • Dynamic Agent Switching: Switch between specialized agents during execution
  • Type-Safe Context: Full type safety for context parameters and outputs
  • Stateful Chat Interface: Build chat applications with built-in state management
  • Event Streaming: Real-time streaming of agent responses and tool calls

Quick Start

import asyncio

from liteswarm.core import Swarm
from liteswarm.types import LLM, Agent, Message


async def main() -> None:
    # Create a simple agent
    agent = Agent(
        id="assistant",
        instructions="You are a helpful assistant.",
        llm=LLM(model="gpt-4o"),
    )

    # Create swarm and execute
    swarm = Swarm()
    result = await swarm.execute(
        agent=agent,
        messages=[Message(role="user", content="Hello!")],
    )
    print(result.agent_response.content)


if __name__ == "__main__":
    asyncio.run(main())

Installation

pip install liteswarm

For more details, check out: