Super connection middleware about multi-agent and skills
Project description
Lyrics - Super connection middleware about multi-agent and skills
Lyrics is a bash command proxy server designed for AI Agents to securely execute Agent Skills commands in containerized environments.
๐ฏ Why Lyrics?
Agent Skills need a secure bash environment to:
- Execute document processing (PDF, Excel, etc.)
- Run Python scripts and utilities
- Manage file system operations
- Maintain persistent shell sessions
๐๏ธ Architecture
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FastAPI Server โ
โ โข REST API (/api/v1/*) โ
โ โข Health checks โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Service Layer โ
โ โข Business logic โ
โ โข Thread pool management โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Command Processing โ File System โ
โ โข Security validationโ Path resolve โ
โ โข Shell sessions โ Access controlโ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ Agent Skills (/skills) โ
โ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โ
โ โ pdf โ โ xlsx โ โ Custom โ โ
โ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Key Components
- CommandParser: Validates bash commands with security checks
- CommandExecutor: Executes commands using persistent shell sessions
- PathResolver: Resolves skill/workspace paths
- PathValidator: Enforces security policies
๐ Quick Start
Installation
Option 1: Install from PyPI (Recommended)
pip install ailyrics
Option 2: Install from Source (Development)
# Clone project
git clone https://github.com/your-org/lyrics.git
cd lyrics
# Install dependencies
uv sync
Start Server
# PyPI installation
python -m lyrics.server --host 0.0.0.0 --port 8870
# Source development
uv run python -m lyrics.server --host 0.0.0.0 --port 8870
# Docker mode (source only)
make docker-up
Verify Installation
curl http://localhost:8870/api/v1/health
# Returns: {"status": "healthy", "service": "lyrics", "api_version": "v1"}
๐ก Core API
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/v1/health |
Health check |
POST |
/api/v1/bash/execute |
Execute bash commands |
GET |
/api/v1/skills |
List all skills |
GET |
/api/v1/skills/{name} |
Get specific skill |
Execute Commands
curl -X POST http://localhost:8870/api/v1/bash/execute \
-H "Content-Type: application/json" \
-d '{"command": "ls -la /skills/public"}'
๐ง Agent Skills
Skill Structure
skill-name/
โโโ SKILL.md # YAML metadata + instructions (required)
โโโ scripts/ # Utility scripts (optional)
โโโ reference/ # Reference docs (optional)
โโโ data/ # Data files (optional)
YAML Frontmatter Format
---
name: pdf-processing
description: PDF toolkit for text extraction, form filling, etc.
license: MIT
---
# PDF Processing Guide
...detailed content...
Available Skills
- pdf: PDF document processing (text extraction, form filling)
- xlsx: Excel spreadsheet processing (formulas, data analysis)
โ ๏ธ Security Constraints
The system blocks dangerous patterns for security:
- Shell operators:
;,&&,||,|,$,`,>,<,&โ - Path traversal:
../../../etc/passwdโ - Command injection attempts โ
Alternative: Use Python
# โ
Correct way
python3 -c "with open('file.txt', 'w') as f: f.write('content')"
๐ Python Client Example
import asyncio
import httpx
async def main():
async with httpx.Client() as client:
# Health check
health = await client.get("http://localhost:8870/api/v1/health")
print(f"Service status: {health.json()['status']}")
# Execute command
result = await client.post(
"http://localhost:8870/api/v1/bash/execute",
json={"command": "echo 'Hello Lyrics!'"}
)
print(f"Output: {result.json()['stdout']}")
asyncio.run(main())
๐ ๏ธ Development
Project Structure
src/lyrics/
โโโ server.py # FastAPI main server
โโโ bash/ # Bash command processing
โโโ filesystem/ # File system operations
โโโ commands/ # Command handlers
Running Tests
# Full integration tests (recommended)
make docker-test
# Unit tests
make test
Code Quality
make fmt # Format code
make check # Check code quality
๐ Configuration
| Variable | Default | Description |
|---|---|---|
SKILLS_PATH |
/skills |
Skills directory |
WORKSPACE_PATH |
/workspace |
Working directory |
LOG_LEVEL |
INFO |
Log level |
HOST |
0.0.0.0 |
Server host |
PORT |
8870 |
Server port |
๐ค Contributing
- Fork the project
- Create feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Create Pull Request
๐ License
MIT License - see the LICENSE file for details.
Built for the Agent Skills ecosystem ๐
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 ailyrics-0.1.0.tar.gz.
File metadata
- Download URL: ailyrics-0.1.0.tar.gz
- Upload date:
- Size: 281.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25254f32492dc5e47ee8639173eb58580372139777cf0c85b5322fcbc1065ee3
|
|
| MD5 |
f7bb5799fe0f0b6efd2aefc93e678fda
|
|
| BLAKE2b-256 |
7511b568e042bb4a027d9c97786de8e447b73bab6929cb7c053b328a2c6d6ed6
|
File details
Details for the file ailyrics-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ailyrics-0.1.0-py3-none-any.whl
- Upload date:
- Size: 40.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e822483b9bde50075e198d5eb789fcb1df88efaebfe98ea1b4b3a79d844f166e
|
|
| MD5 |
07786acccfaab15a200bce1c322e3f2c
|
|
| BLAKE2b-256 |
69f020eef76c61e92afe1c809ec6ebed51b93ddaa5eca328baa24062238d3110
|