Lemur is an open-source language agent framework that enables developers to build and deploy AI agents for text reasoning, code generation, and natural language processing tasks. It benefits operations teams by automating workflows and integrating with Python-based systems. Lemur connects to Hugging Face models and supports Claude agents.
git clone https://github.com/OpenLemur/Lemur.githttps://arxiv.org/abs/2310.06830
["Install Lemur and required dependencies: `pip install lemur transformers`","Choose your integration point: Select between Hugging Face models (for NLP tasks) or Claude agents (for conversational workflows).","Define your task parameters: Specify the exact action (e.g., classification, entity extraction) and provide sample data for testing.","Implement error handling: Add try-catch blocks for common issues like API limits or malformed input, as shown in the example.","Deploy and monitor: Run the script in your environment and log outputs to track performance. Use the `processed_at` timestamps to measure processing time."]
Automate the generation of code snippets based on user-defined prompts.
Create intelligent chatbots that can engage in meaningful conversations and provide accurate information.
Develop interactive agents that can adapt to user feedback and perform tasks in real-world environments.
Implement natural language processing tasks such as summarization, translation, or question answering.
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/OpenLemur/LemurCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Use Lemur to automate [TASK] by writing a Python script that integrates with [HUGGING_FACE_MODEL/CLAUDE_AGENT]. The script should [SPECIFIC_ACTION, e.g., 'extract key entities from customer support tickets and categorize them by urgency']. Include error handling for [POTENTIAL_ISSUES, e.g., 'API rate limits or malformed input data']. Test the script with sample data: [PASTE_3_EXAMPLES].
```python
# Lemur Agent Script for Automated Ticket Categorization
# Integrates with Hugging Face's 'distilbert-base-uncased' model
import lemur
from transformers import pipeline
from datetime import datetime
import logging
# Configure logging
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
# Initialize Lemur agent with Hugging Face model
agent = lemur.LemurAgent(
model_name="distilbert-base-uncased",
task="text-classification",
device=-1 # Use CPU for inference
)
# Define ticket categories and urgency levels
CATEGORIES = {
"billing": ["payment issue", "refund request", "invoice error"],
"technical": ["login problem", "feature request", "bug report"],
"general": ["feedback", "question", "compliment"]
}
URGENCY_LEVELS = {
"high": ["payment issue", "login problem", "bug report"],
"medium": ["refund request", "feature request", "question"],
"low": ["feedback", "compliment", "invoice error"]
}
# Sample ticket data (simulating real support tickets)
sample_tickets = [
{
"ticket_id": "TKT-2023-0456",
"subject": "Login not working for new account",
"description": "I created a new account yesterday but can't log in. Error message says 'Invalid credentials'.",
"timestamp": "2023-11-15T09:30:00Z"
},
{
"ticket_id": "TKT-2023-0457",
"subject": "Monthly subscription charge",
"description": "I was charged twice this month for my subscription. Can you refund the extra charge?",
"timestamp": "2023-11-15T10:15:00Z"
},
{
"ticket_id": "TKT-2023-0458",
"subject": "Love the new dashboard feature!",
"description": "Just wanted to say how much I appreciate the new analytics dashboard. It's exactly what I needed!",
"timestamp": "2023-11-15T11:42:00Z"
}
]
# Process tickets
def process_ticket(ticket):
try:
# Extract entities using Lemur agent
entities = agent.extract_entities(ticket["description"])
logger.info(f"Extracted entities for {ticket['ticket_id']}: {entities}")
# Classify ticket
category = "general"
urgency = "low"
for cat, keywords in CATEGORIES.items():
if any(keyword in ticket["description"].lower() for keyword in keywords):
category = cat
break
for level, keywords in URGENCY_LEVELS.items():
if any(keyword in ticket["description"].lower() for keyword in keywords):
urgency = level
break
# Return structured output
return {
"ticket_id": ticket["ticket_id"],
"category": category,
"urgency": urgency,
"entities": entities,
"processed_at": datetime.utcnow().isoformat()
}
except Exception as e:
logger.error(f"Failed to process ticket {ticket['ticket_id']}: {str(e)}")
return {
"ticket_id": ticket["ticket_id"],
"error": str(e),
"processed_at": datetime.utcnow().isoformat()
}
# Execute processing
processed_tickets = [process_ticket(ticket) for ticket in sample_tickets]
# Output results
print("\n=== Ticket Processing Results ===")
for result in processed_tickets:
print(f"\nTicket ID: {result['ticket_id']}")
print(f"Category: {result['category']}")
print(f"Urgency: {result['urgency']}")
print(f"Entities: {result.get('entities', 'N/A')}")
if 'error' in result:
print(f"Error: {result['error']}")
```
### Output:
```
=== Ticket Processing Results ===
Ticket ID: TKT-2023-0456
Category: technical
Urgency: high
Entities: ['login', 'new account', 'credentials']
Ticket ID: TKT-2023-0457
Category: billing
Urgency: high
Entities: ['subscription charge', 'refund', 'extra charge']
Ticket ID: TKT-2023-0458
Category: general
Urgency: low
Entities: ['dashboard feature', 'analytics dashboard']
```
The script successfully categorized all tickets, identified key entities, and assigned urgency levels. The technical team can now prioritize the login issue (TKT-2023-0456) and billing problem (TKT-2023-0457) as high-priority items. The compliment ticket (TKT-2023-0458) was correctly routed to the general queue for acknowledgment.Unlock data insights with interactive dashboards and collaborative analytics capabilities.
IronCalc is a spreadsheet engine and ecosystem
ITIL-aligned IT service management platform
Customer feedback management made simple
Enterprise workflow automation and service management platform
Automate your spreadsheet tasks with AI power
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan