Metadata-Version: 2.4
Name: klynx
Version: 0.0.1
Summary: A sophisticated, universal agentic AI coding framework built on LangGraph and LiteLLM.
Author-email: QZX <creator@example.com>
License: MIT License
Project-URL: Homepage, https://github.com/qzx/klynx
Project-URL: Bug Tracker, https://github.com/qzx/klynx/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: litellm>=1.40.0
Requires-Dist: langchain-core>=0.2.0
Requires-Dist: langgraph>=0.2.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: openai>=1.30.0
Requires-Dist: pydantic>=2.7.0
Requires-Dist: rich>=13.0.0
Requires-Dist: playwright>=1.40.0
Dynamic: license-file

# Klynx

![PyPI - Version](https://img.shields.io/pypi/v/klynx)
![License](https://img.shields.io/github/license/qzx/klynx)

**Klynx** is an advanced, highly customizable autonomous agent framework built on top of [LangGraph](https://langchain-ai.github.io/langgraph/) and [LiteLLM](https://github.com/BerriAI/litellm). It is designed to seamless integrate with top-tier LLM providers globally (OpenAI, Anthropic, Google, DeepSeek, Zhipu, Moonshot, etc.) while offering a robust tool-calling infrastructure and built-in interactive terminal interfaces.

## 🚀 Features
- **Universal LLM Routing:** Write code once, use any model. Powered by `litellm`.
- **Advanced Agent Architectures:** Built with `langgraph` core state machines for recursive reasoning, memory, error reflection, and persistent context loops.
- **Robust Tools Environment:** Ships with native tools (e.g. Browser automation with Playwright, OS terminal integration, local filesystem querying).
- **Interactive TUI:** Comes with a built-in rich Text User Interface (`klynx/tui_app.py`) for streaming console interactions.
- **Proxy-Resistant:** `LiteLLM` adapters are configured internally to gracefully map local network environments without throwing blocking SSL errors.

## 📦 Installation

Install Klynx directly from PyPI:

```bash
pip install klynx
```

*(Note: If using browser features, remember to run `playwright install chromium` once).*

## ⚡ Quick Start

With Klynx, creating a multi-modal agent and interacting with it requires just a few lines of code.

### 1. Initialize your Model

Klynx expects explicit passing of your API keys or auto-loading from `.env` files. We fully support major models.

```python
import os
from klynx.model import setup_model

# Option A: Connect to DeepSeek Reasoner
# api_key = os.getenv("DEEPSEEK_API_KEY")
# model = setup_model("deepseek", "deepseek-reasoner", api_key)

# Option B: Connect to Anthropic Claude 3.5 Sonnet
# api_key = os.getenv("ANTHROPIC_API_KEY")
# model = setup_model("anthropic", "claude-3-5-sonnet", api_key)

# Option C: Connect to OpenAI GPT-4o
api_key = os.getenv("OPENAI_API_KEY")
model = setup_model("openai", "gpt-4o", api_key)
```

### 2. Create the Agent

Attach your model to a `KlynxAgent` state machine, optionally granting it all system tools.

```python
from klynx.agent import create_agent

# Initialize agent in current directory
agent = create_agent(
    working_dir=os.getcwd(),
    model=model,
    max_iterations=15 
)

# Grant agent access to all default tools (Browser, Files, Terminal)
agent.add_tools("all")
```

### 3. Run a Task

Execute advanced instructions, allowing the agent to reason, browse, and execute code sequentially to arrive at a solution.

```python
task = "Search the web for the latest Python version changes and write a summary to a file named 'python_updates.md'."
result = agent.invoke(task)

if result.get("task_completed"):
    print("Success! Agent Summary:", result.get("summary_content"))
```

## 📜 License
This software is licensed under the [MIT License](LICENSE).
