Skip to main content

A core framework for multi-agent LLM ecosystems

Project description

LangSwarm-Core

LangSwarm-Core is a framework designed to support multi-agent systems using Large Language Models (LLMs). It provides utilities, memory management, logging integration, and agent orchestration tools to build robust AI ecosystems with modularity and flexibility.

Features

  • Agent Wrappers: Easily integrate with LangChain, OpenAI, Hugging Face, and LlamaIndex agents.
  • Memory Management: Support for in-memory or external memory, with customizable options.
  • Logging: Seamless integration with LangSmith for advanced logging and tracing.
  • Factory Design: Create and manage multiple agents with configurable setups.
  • Utilities: Helper functions for token management, text cleaning, and cost estimation.
  • Registry: Centralized agent registry to manage and access agents dynamically.

Installation

Prerequisites

  • Python 3.8 or higher
  • Install dependencies:
    pip install -r requirements.txt
    

From PyPI

pip install langswarm-core

Usage

Quick Start

Here's an example of how to use LangSwarm-Core to create an agent and interact with it:

from core.factory.agents import AgentFactory

# Create a LangChain agent
agent = AgentFactory.create(
    name="example_agent",
    agent_type="langchain-openai",
    memory=[],
    langsmith_api_key="your-langsmith-api-key",
    model="gpt-4"
)

# Use the agent to respond to queries
response = agent.chat("What is LangSwarm?")
print(response)

Memory Integration

LangSwarm-Core supports memory out of the box. Here's how to initialize an agent with memory:

from core.factory.agents import AgentFactory

memory = []  # Initialize in-memory storage

agent = AgentFactory.create(
    name="memory_agent",
    agent_type="langchain-openai",
    memory=memory,
    model="gpt-4"
)

response = agent.chat("Remember this: LangSwarm is awesome.")
print(response)

Components

Wrappers

Wrappers add modular capabilities such as:

  • Memory management (MemoryMixin)
  • Logging integration (LoggingMixin)

Utilities

Helper functions for:

  • Token and cost estimation
  • Text processing
  • JSON and YAML validation

Factory

Use the AgentFactory to easily create and configure agents:

agent = AgentFactory.create(
    name="example",
    agent_type="llamaindex",
    documents=["Sample text for indexing"]
)

Development

Setting Up the Environment

  1. Clone the repository:
    git clone https://github.com/aekdahl/langswarm-core.git
    cd langswarm-core
    
  2. Create a virtual environment:
    python3 -m venv venv
    source venv/bin/activate
    
  3. Install dependencies:
    pip install -r requirements.txt
    

Running Tests

Tests are located in the tests/ directory. Run them using pytest:

pytest

Contributing

We welcome contributions! To get started:

  1. Fork the repository.
  2. Create a feature branch.
  3. Make your changes and write tests.
  4. Submit a pull request.

Roadmap

  • Add support for additional LLM providers.
  • Expand orchestration capabilities with reinforcement learning agents.
  • Develop CLI tools for managing agents.

License

This project is licensed under the MIT License. See the LICENSE file for details.


Acknowledgments

LangSwarm-Core relies on several amazing libraries, including:


Feel free to modify this to better fit your specific project details or branding!

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

langswarm_core-0.0.7.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

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

langswarm_core-0.0.7-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file langswarm_core-0.0.7.tar.gz.

File metadata

  • Download URL: langswarm_core-0.0.7.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.20

File hashes

Hashes for langswarm_core-0.0.7.tar.gz
Algorithm Hash digest
SHA256 c8743cbe638a95bf0adf0a847ec0940e19654ac2f1683472e6e7800b5fb028bc
MD5 45cc7a396768440e864e5916585d6add
BLAKE2b-256 14a81b879d6169d41e8bec3d9b2c6300e3e0b2511a9e30cb98effedf98121f33

See more details on using hashes here.

File details

Details for the file langswarm_core-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: langswarm_core-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.20

File hashes

Hashes for langswarm_core-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 d01eca26dd1d71d1054aba82473c435ffb095a25d85762e8e1f8e4ff0a474fa0
MD5 319f98de489f31a37a5ba742fd863c5d
BLAKE2b-256 bc329fcb924266852baa6cd8b978401e4baf15e65cb96ef8e0196434211d27aa

See more details on using hashes here.

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