No project description provided
Project description
Limbic - A Framework for Building AI Agents
Limbic is a Python framework for building AI agents that can use tools, maintain memory, and plan their actions. It's designed to be modular, extensible, and easy to use.
Features
- 🤖 ReAct pattern implementation for tool use
- 🧠 Memory management for maintaining context
- 📝 Planning capabilities for complex tasks
- 🛠️ Easy tool creation and management
- 📊 Built-in statistics and logging
- 💾 Session management for saving/loading agent state
Installation
# Clone the repository
git clone https://github.com/quotient-ai/limbic.git
cd limbic
# Install dependencies using Poetry
poetry install
Quick Start
Here's a simple example of creating and using an agent:
from limbic.core import Agent, AgentConfig
from limbic.tools import calculator, stock_price
# Create an agent with some tools
agent = Agent(
tools=[calculator, stock_price],
model="gpt-4o-mini",
config=AgentConfig()
)
# Run a task
result = agent.run("Calculate the total cost of buying 10 shares of AAPL")
print(result)
Creating Custom Tools
You can create custom tools using the @tool decorator:
from limbic.tools import tool
@tool
def my_custom_tool(param1: str, param2: int) -> str:
"""
A custom tool that does something interesting.
Parameters:
-----------
param1: str
Description of param1
param2: int
Description of param2
Returns:
--------
str
Description of the return value
"""
# Your tool implementation here
return f"Processed {param1} {param2} times"
Agent Configuration
The AgentConfig class allows you to customize agent behavior:
from limbic.core import AgentConfig
config = AgentConfig(
max_steps=10, # Maximum number of steps before stopping
show_steps=True, # Show detailed step information
tool_choice="auto", # Tool selection mode
planning_interval=2 # How often to run planning steps
)
Memory Management
The framework includes built-in memory management treated as short-term memory (i.e. the message history).
from limbic.memory import AgentMemory
# Memory is automatically managed by the agent
agent = Agent(
tools=[...],
model="gpt-4-turbo-preview"
)
# The agent will maintain context between steps
result = agent.run("First task")
result = agent.run("Follow-up task using previous context")
Session Management
You can save and load agent sessions:
# Save a session
agent.save_session("my_session.json")
# Load a session
loaded_agent = Agent.load_from_session("my_session.json")
Error Handling
Tools should use the ToolExecutionError for proper error handling:
from limbic.tools import tool, ToolExecutionError
@tool
def my_tool():
try:
# Your tool implementation
pass
except Exception as e:
raise ToolExecutionError(
message="User-friendly error message",
developer_message=f"Detailed error: {str(e)}"
)
Example: Research Agent
Here's how to create a research agent using the framework:
from limbic.core import Agent, AgentConfig
from limbic.research import get_research_tools
# Create a research agent
agent = Agent(
tools=get_research_tools(),
model="gpt-4o-mini",
config=AgentConfig()
)
# Run a research task
result = agent.run("Research the latest developments in quantum computing")
Contributing
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file limbic-0.0.1.tar.gz.
File metadata
- Download URL: limbic-0.0.1.tar.gz
- Upload date:
- Size: 18.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b78a3187f8ac334fb1a70bf614eb61514bad12c60e49b01e3af253276cbe968a
|
|
| MD5 |
9237700f44ed9d8cec56ca223b02c13d
|
|
| BLAKE2b-256 |
29e62dd0130b3c538223eeae3efbcefb89c2eb6f2a3138834ed71e431a59d9cb
|
File details
Details for the file limbic-0.0.1-py3-none-any.whl.
File metadata
- Download URL: limbic-0.0.1-py3-none-any.whl
- Upload date:
- Size: 23.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
528e7f7f58fd7ac4e7c6ac62ecd302a2c5dd6c2731670c1696931997882bcd0f
|
|
| MD5 |
c825d8e8f42433116c0718f962e8f1c5
|
|
| BLAKE2b-256 |
61d72a01319c29a1c41e6814b5c650851ca129e72aa74ecaba7d63eb679ecbac
|