Skip to main content

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)

TODO

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

  1. Fork the project
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Create Pull Request

๐Ÿ“„ License

MIT License - see the LICENSE file for details.


Built for the Agent Skills ecosystem ๐Ÿš€

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

ailyrics-0.1.0rc0.tar.gz (281.3 kB view details)

Uploaded Source

Built Distribution

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

ailyrics-0.1.0rc0-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file ailyrics-0.1.0rc0.tar.gz.

File metadata

  • Download URL: ailyrics-0.1.0rc0.tar.gz
  • Upload date:
  • Size: 281.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.13

File hashes

Hashes for ailyrics-0.1.0rc0.tar.gz
Algorithm Hash digest
SHA256 ed30eff1ded946c5750c8eba0cbc0030c7909ffa54b30cde3c252413791f46bc
MD5 25e84e257d3931b4c7858bd61a22a0d4
BLAKE2b-256 c6713d5f5ac89e2847dc7ffc83dbd18e9153f824cfc8ef147127a0d9467ef4cc

See more details on using hashes here.

File details

Details for the file ailyrics-0.1.0rc0-py3-none-any.whl.

File metadata

File hashes

Hashes for ailyrics-0.1.0rc0-py3-none-any.whl
Algorithm Hash digest
SHA256 bb678f6559bf204db1f76955f460e71536a9fd1540e1a515dffba47909b0d281
MD5 5421d80a8a647496587fb7ad86c374e5
BLAKE2b-256 b804e632d1583f9ab9e172bd97a1879bb94e342febe687ec5582a4b2fcd8111c

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