A lightweight AI coding agent with file operations and shell execution capabilities
Project description
Agenix ๐ค
A lightweight AI coding agent powered by LLMs.
๐ฏ Key Features
- ๐ฆ Easy-to-Use Python Library - Simple SDK that works as both CLI tool and importable library
- ๐ Agent Loop with Tool Execution - Autonomous REPL loop where agent calls tools and continues until task completion
- ๐ ๏ธ Simple Tools Without MCP - Four core tools (Read, Write, Edit, Bash) + Grep, no MCP dependencies
- ๐ Progressive Disclosure Skills - Skills loaded on-demand to keep context minimal until needed
- ๐ 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/quitor/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:
- Default:
agenix/default-skills/(bundled) - User:
~/.agenix/skills/(global) - Project:
.agenix/skills/(local, highest priority)
Built-in skills:
pdf- PDF manipulation and extractionxlsx- Excel spreadsheet operationsdocx- Word document processingpptx- PowerPoint presentationsbrowser-use- Web automationfind-skills- Skill discoveryskill-creator- Skill creation guide
See Skills Guide for creating custom skills.
๐ Documentation
Comprehensive documentation available:
- Documentation Index - Complete documentation hub
- CLI Reference - Command-line usage guide
- SDK Documentation - Programmatic API reference
- Skills Guide - Progressive disclosure system
- Extensions Guide - Build custom extensions
- Session Management - Working with sessions
- Settings Reference - Configuration options
- API Reference - Auto-generated API docs
๐งช 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
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d500d4ee2103782d8b4782790a266064c9667d2d9c95b22e294839f2f424bdbf
|
|
| MD5 |
3d34d79169ec129cfd9081415085e38b
|
|
| BLAKE2b-256 |
cc9d5a58e6296fc629ecb8f923f7a2b570240670498794c05345d327e25432dc
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f355b6706c1658fc1d7207d57e05b32b5eaa9d02d6a9db0230877366c4e80c18
|
|
| MD5 |
4a5fcb0fbb881fab891b3328fbe88565
|
|
| BLAKE2b-256 |
b6c9e0a69abfec8a21df3bcfd85684ed9fa5c462075cef0ece83bbe6ac7123f0
|