Langur is designed to streamline the creation of consistent and portable LLM agents, allowing developers to easily configure and run tasks like grading quizzes. With features for planning, execution, and visualization, Langur not only facilitates development but also enables a deeper understanding of agent behavior. Dive into the future of LLM development with us.
Langur is an innovative library designed to facilitate the development of consistent, observable, and portable LLM (Large Language Model) agents. It provides a robust framework for building intelligent agents capable of executing complex tasks while offering modular behavior and customization options.
Key Features
- Modular Behavior: Langur is structured around several metacognitive workers that operate on a shared cognition graph, enabling the easy addition of new behaviors without affecting the entire system.
- Observability: Visualize the agent's intent through a dynamic behavioral graph, providing insights during development.
- Custom Connectors: Develop and integrate bespoke connectors for unique interaction modes, including built-in connectors optimized for Langur's architecture.
- Portable and Serializable: The behavior state of agents is stored in a JSON format, making it easy to save, load, and transfer agent behaviors across different environments.
Getting Started
Langur employs a simple setup for initiating tasks, as demonstrated below:
from langur import Langur
from langur.connectors import Workspace
agent = Langur("Grade quizzes")
agent.use(
Workspace(path="./workspace")
)
agent.run()
This example sets up a Langur agent aimed at automatically grading quizzes found within a specified workspace and stores the results in grades.csv
.
Observing Behavior
Before executing plans, you can observe the actions your agent intends to perform using:
from langur import Signal
agent.run(until=Signal.PLAN_DONE)
Caching Behavior
To reuse an agent's behavior, save its state:
agent.save("agent_with_great_plan.json")
And later, load it for continuation:
agent = Langur.load("agent_with_great_plan.json")
Building Custom Connectors
Develop your own connectors to expand functionality:
from langur import Langur, Connector, action
class Calculator(Connector):
@action
def add(self, x: int, y: int):
'''Add two numbers'''
return x + y
By using Langur, developers can tap into the power of LLMs seamlessly, enabling enhanced interaction with model outputs through rich, context-aware connectors.
Roadmap
Langur is under active development, with plans for new documentation, CLI tools, improved debuggers, and an expanding set of native connectors aimed at making it the leading library for practical LLM agent applications.
Join the Community
Become part of the Langur ecosystem! Engage with developers through the Langur Discord for support, feedback, or to share ideas.
Langur is your go-to library for crafting powerful LLM agents tailored for real-world utility.