Skip to main content

A lightweight AI coding agent with file operations and shell execution capabilities

Project description

Agenix ๐Ÿค–

PyPI version Python 3.8+ License: MIT Tests

A lightweight AI coding agent powered by LLMs.

๐ŸŽฏ Key Features

  1. ๐Ÿ“ฆ Easy-to-Use Python Library - Simple SDK that works as both CLI tool and importable library
  2. ๐Ÿ”„ Agent Loop with Tool Execution - Autonomous REPL loop where agent calls tools and continues until task completion
  3. ๐Ÿ› ๏ธ Simple Tools Without MCP - Four core tools (Read, Write, Edit, Bash) + Grep, no MCP dependencies
  4. ๐Ÿ“š Progressive Disclosure Skills - Skills loaded on-demand to keep context minimal until needed
  5. ๐Ÿ”Œ Extension System - Hot-reloadable extensions for custom tools, commands, and event handlers

๐Ÿ“ฆ Installation

From PyPI

pip install agenix

From Source

git clone https://github.com/tczhangzhi/agenix.git
cd agenix
pip install -e .

Using Conda

conda install -c conda-forge agenix

๐Ÿš€ Quick Start

Setup API Keys

export OPENAI_API_BASE="https://api.openai.com/v1"
export OPENAI_API_KEY="your-key-here"

Usage

# Interactive mode (enter TUI)
agenix

# Direct message
agenix "Read the README.md file and summarize it"

# Use specific model
agenix --model claude-3-5-sonnet-20241022 "analyze this code"

# Specify working directory
agenix --working-dir /path/to/project

# Load a previous session
agenix --session 20240101_120000

# Custom system prompt
agenix --system-prompt "You are a Python expert"

# Both python -m and agenix command work
python -m agenix "your message"

Interactive Commands

  • /help - Show help message
  • /clear - Clear conversation history
  • /sessions - List saved sessions
  • /load <session_id> - Load a session
  • /quit or /exit - Exit the program

๐Ÿ”Œ Programmatic SDK

Use agenix as a library in your Python applications:

import asyncio
from agenix import create_session

async def main():
    # Create a session
    session = await create_session(
        api_key="your-openai-api-key",
        model="gpt-4o",
        working_dir="."
    )

    # Send prompts
    response = await session.prompt("What files are in the current directory?")
    print(response)

    # Continue conversation
    response = await session.prompt("Can you read the README?")
    print(response)

    # Get conversation history
    messages = session.get_messages()
    print(f"Conversation has {len(messages)} messages")

    # Clean up
    await session.close()

if __name__ == "__main__":
    asyncio.run(main())

See SDK Documentation for full API reference.

๐ŸŽฏ Extensions

Extend agenix with custom tools, commands, and event handlers.

Extension Locations

  • Global: ~/.agenix/extensions/
  • Project: .agenix/extensions/

Example Extension

# ~/.agenix/extensions/weather.py
from agenix.extensions import ToolDefinition

async def setup(agenix):
    """Extension setup function."""

    async def get_weather(params, ctx):
        city = params["city"]
        # Fetch weather data...
        return f"Weather in {city}: Sunny, 72ยฐF"

    # Register custom tool
    agenix.register_tool(ToolDefinition(
        name="get_weather",
        description="Get current weather for a city",
        parameters={
            "type": "object",
            "properties": {
                "city": {"type": "string", "description": "City name"}
            },
            "required": ["city"]
        },
        execute=get_weather
    ))

Event Handlers

# .agenix/extensions/logger.py
from agenix.extensions import EventType

async def setup(agenix):
    @agenix.on(EventType.TOOL_CALL)
    async def log_tool_calls(event, ctx):
        print(f"๐Ÿ”ง Tool called: {event.tool_name}")

See EXTENSIONS.md for complete documentation.

๐Ÿ“š Agent Skills

Agenix supports progressive disclosure of specialized knowledge through Agent Skills.

Skills are automatically loaded from:

  1. Default: agenix/default-skills/ (bundled)
  2. User: ~/.agenix/skills/ (global)
  3. Project: .agenix/skills/ (local, highest priority)

Built-in skills:

  • pdf - PDF manipulation and extraction
  • xlsx - Excel spreadsheet operations
  • docx - Word document processing
  • pptx - PowerPoint presentations
  • browser-use - Web automation
  • find-skills - Skill discovery
  • skill-creator - Skill creation guide

See Skills Guide for creating custom skills.

๐Ÿ“š Documentation

Comprehensive documentation available:

๐Ÿงช Testing

Run tests using pytest:

# Run all tests
pytest

# Run with coverage
pytest --cov=agenix tests/

# Or use make
make test

๐Ÿ› ๏ธ Development

Setup Development Environment

git clone https://github.com/tczhangzhi/agenix.git
cd agenix
make dev  # or: pip install -e .[dev]

Common Commands

make help       # Show all commands
make install    # Install in development mode
make test       # Run tests
make clean      # Clean build artifacts
make build      # Build distribution
make upload     # Upload to PyPI

Project Structure

agenix/
โ”œโ”€โ”€ agenix/              # Main package
โ”‚   โ”œโ”€โ”€ __init__.py      # Package exports (SDK)
โ”‚   โ”œโ”€โ”€ __main__.py      # Entry point for python -m agenix
โ”‚   โ”œโ”€โ”€ cli.py           # CLI implementation
โ”‚   โ”œโ”€โ”€ sdk.py           # Programmatic SDK
โ”‚   โ”œโ”€โ”€ core/            # Core modules
โ”‚   โ”‚   โ”œโ”€โ”€ agent.py     # Agent runtime
โ”‚   โ”‚   โ”œโ”€โ”€ llm.py       # LLM providers
โ”‚   โ”‚   โ”œโ”€โ”€ session.py   # Session management
โ”‚   โ”‚   โ”œโ”€โ”€ skills.py    # Skills system
โ”‚   โ”‚   โ””โ”€โ”€ messages.py  # Message types
โ”‚   โ”œโ”€โ”€ tools/           # Built-in tools
โ”‚   โ”‚   โ”œโ”€โ”€ read.py      # File reading
โ”‚   โ”‚   โ”œโ”€โ”€ write.py     # File writing
โ”‚   โ”‚   โ”œโ”€โ”€ edit.py      # File editing
โ”‚   โ”‚   โ”œโ”€โ”€ bash.py      # Shell execution
โ”‚   โ”‚   โ””โ”€โ”€ grep.py      # Code search
โ”‚   โ”œโ”€โ”€ extensions/      # Extension system
โ”‚   โ”‚   โ”œโ”€โ”€ types.py     # Event types & API
โ”‚   โ”‚   โ”œโ”€โ”€ loader.py    # Extension loading
โ”‚   โ”‚   โ””โ”€โ”€ runner.py    # Extension execution
โ”‚   โ”œโ”€โ”€ default-skills/  # Bundled skills
โ”‚   โ”‚   โ”œโ”€โ”€ pdf/
โ”‚   โ”‚   โ”œโ”€โ”€ xlsx/
โ”‚   โ”‚   โ”œโ”€โ”€ docx/
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ””โ”€โ”€ ui/              # Terminal UI
โ”œโ”€โ”€ tests/               # Test suite (126 tests)
โ”‚   โ”œโ”€โ”€ core/            # Core tests
โ”‚   โ”œโ”€โ”€ tools/           # Tool tests
โ”‚   โ””โ”€โ”€ ui/              # UI tests
โ”œโ”€โ”€ examples/            # Usage examples
โ”‚   โ”œโ”€โ”€ sdk_basic.py     # SDK example
โ”‚   โ”œโ”€โ”€ extension_weather.py
โ”‚   โ””โ”€โ”€ extension_monitor.py
โ”œโ”€โ”€ docs/                # Documentation
โ”‚   โ””โ”€โ”€ api/             # Generated API docs
โ”œโ”€โ”€ setup.py             # Package configuration
โ”œโ”€โ”€ Makefile             # Development commands
โ”œโ”€โ”€ EXTENSIONS.md        # Extension guide
โ””โ”€โ”€ README.md

๐Ÿ“š Publishing

To PyPI

# Build
make build

# Upload (requires twine and PyPI credentials)
make upload

# Or manually:
python setup.py sdist
twine upload dist/agenix-*.tar.gz

To Conda

conda build conda/
anaconda upload <path-to-package>

๐Ÿ“„ License

MIT License - See LICENSE file

๐Ÿ‘ค Author

ZHANG Zhi - tczhangzhi

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

agenix-0.0.1.tar.gz (3.7 MB view details)

Uploaded Source

Built Distribution

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

agenix-0.0.1-py3-none-any.whl (4.3 MB view details)

Uploaded Python 3

File details

Details for the file agenix-0.0.1.tar.gz.

File metadata

  • Download URL: agenix-0.0.1.tar.gz
  • Upload date:
  • Size: 3.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for agenix-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d500d4ee2103782d8b4782790a266064c9667d2d9c95b22e294839f2f424bdbf
MD5 3d34d79169ec129cfd9081415085e38b
BLAKE2b-256 cc9d5a58e6296fc629ecb8f923f7a2b570240670498794c05345d327e25432dc

See more details on using hashes here.

File details

Details for the file agenix-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: agenix-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for agenix-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f355b6706c1658fc1d7207d57e05b32b5eaa9d02d6a9db0230877366c4e80c18
MD5 4a5fcb0fbb881fab891b3328fbe88565
BLAKE2b-256 b6c9e0a69abfec8a21df3bcfd85684ed9fa5c462075cef0ece83bbe6ac7123f0

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