Skip to main content

F.A.I.L. Kit Language Server for Python - Forensic analysis for LangChain, CrewAI, and AutoGen

Project description

F.A.I.L. Kit Python Language Server

Language Server Protocol (LSP) implementation for Python AI agent frameworks.

Features

  • LangChain Support: Analyze LangChain agents, tools, and chains
  • CrewAI Support: Analyze CrewAI agents, tasks, and crews
  • AutoGen Support: Analyze AutoGen agents and group chats
  • Real-time Diagnostics: Issues appear as you type
  • Quick Fixes: One-click fixes for common issues
  • Hover Information: Detailed issue descriptions on hover

Installation

pip install fail-kit-lsp

Usage

VS Code

Install the F.A.I.L. Kit VS Code extension, which automatically uses this LSP for Python files.

Neovim (nvim-lspconfig)

require('lspconfig').fail_kit_lsp.setup{}

Other Editors

Start the language server:

fail-kit-lsp

The server communicates over stdin/stdout using the Language Server Protocol.

Detected Issues

Rule Category Description
FK001 Audit Tool call without receipt generation
FK002 Reliability LLM call without error handling
FK003 Security Hardcoded secrets in code
FK004 Safety Destructive operation without confirmation
FK005 Resilience LLM call without retry/timeout
FK006 Audit Missing provenance metadata

Example

# This code will trigger FK001 and FK002 warnings

from langchain.agents import AgentExecutor
from langchain_openai import ChatOpenAI

llm = ChatOpenAI()  # FK002: No error handling

# FK001: No receipt generation
result = agent_executor.invoke({"input": "delete all files"})

With F.A.I.L. Kit fixes:

from langchain.agents import AgentExecutor
from langchain_openai import ChatOpenAI
from fail_kit import generate_receipt, audit_logger

llm = ChatOpenAI()

try:
    result = agent_executor.invoke({"input": "delete all files"})
    
    receipt = generate_receipt(
        tool_name="agent_executor",
        input_data={"input": "delete all files"},
        result=result,
    )
    audit_logger.log_action(receipt)
    
except Exception as e:
    audit_logger.log_failure({
        "error_type": type(e).__name__,
        "error_message": str(e),
    })
    raise

Configuration

Create a fail-kit.toml in your project root:

[fail-kit]
# Skip patterns
skip_patterns = ["*_test.py", "test_*.py", "conftest.py"]

# Severity overrides
[fail-kit.severity]
FK001 = "error"  # Treat as error instead of warning
FK005 = "hint"   # Treat as hint instead of info

# Custom patterns
[fail-kit.patterns]
tool_calls = ["my_custom_tool\\.run"]

Development

# Install dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Type checking
mypy fail_kit_lsp

# Format code
black fail_kit_lsp
ruff check fail_kit_lsp

License

MIT

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

fail_kit_lsp-2.0.1.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

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

fail_kit_lsp-2.0.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file fail_kit_lsp-2.0.1.tar.gz.

File metadata

  • Download URL: fail_kit_lsp-2.0.1.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for fail_kit_lsp-2.0.1.tar.gz
Algorithm Hash digest
SHA256 d45abb2550b69d36ea4af6e10a35f54ab7ea7c442189cbe327d60341db45c972
MD5 d70b63621e2bd7781b831e34882701fd
BLAKE2b-256 3338f5298a83f9baf578b9258ede06fb3862eb4cd132269641ccae1ebb0263c1

See more details on using hashes here.

File details

Details for the file fail_kit_lsp-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: fail_kit_lsp-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for fail_kit_lsp-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 06c348eb75e44da062cdf460db656406eae0d67bbc5d7e6efaedd3f2c88b3e6a
MD5 a2b3c497c04a925778a8c8fe2a40276d
BLAKE2b-256 63007a7f5d21777d9619967ec026ccb833d60c4efc38f573ff1cc10ee93146c2

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