Skip to main content

A modern Python SDK to create fully customizable AI agents in a single line of code.

Project description

Noctis - AI Agents for Developers

Noctis is a powerful AI agent framework that provides specialized agents for common developer tasks. Each agent is optimized with domain-specific knowledge and system prompts to deliver expert-level assistance in their respective areas.

๐Ÿš€ Features

  • 10 Specialized Agents for different development domains
  • Memory Persistence using SQLite for context-aware conversations
  • Multiple AI Models support (OpenAI, Ollama)
  • Easy-to-use CLI for quick access to agents
  • Python API for integration into your projects
  • Production Ready with proper error handling and validation

๐Ÿค– Available Agents

Agent Purpose Best For
Code Reviewer Review code for quality, bugs, and best practices Code quality assurance, team code reviews
Debugger Help debug code issues and problems Troubleshooting, error analysis
Documentation Writer Write and improve technical documentation API docs, READMEs, user guides
Security Auditor Audit code for security vulnerabilities Security reviews, vulnerability assessment
Performance Optimizer Analyze and optimize code performance Performance tuning, bottleneck identification
Testing Specialist Create testing strategies and tests Test planning, test case creation
Architect Design software architecture and systems System design, architecture planning
DevOps Engineer Help with DevOps practices and CI/CD Pipeline design, infrastructure setup
Code Generator Generate code from specifications Boilerplate code, implementation
Refactoring Specialist Refactor and improve existing code Code improvement, technical debt reduction

๐Ÿ› ๏ธ Installation

# Clone the repository
git clone https://github.com/yourusername/noctis.git
cd noctis

# Install dependencies
pip install -r requirements.txt

# Install the package in development mode
pip install -e .

๐Ÿ“– Quick Start

Using the CLI

# List all available agents
noctis --list

# Start a code review agent interactively
noctis code_reviewer

# Ask a single question to the debugger agent
noctis debugger -q "Help me fix this Python error"

# Use a specific model
noctis security_auditor -m gpt-4

# Force interactive mode
noctis performance_optimizer -i

Using the Python API

from noctis.predefined_agents import CodeReviewAgent, create_agent

# Method 1: Direct instantiation
code_reviewer = CodeReviewAgent()
response = code_reviewer.ask("Review this code for security issues")

# Method 2: Factory function
debugger = create_agent("debugger")
response = debugger.ask("Help me debug this error")

๐Ÿ”ง Configuration

Environment Variables

# OpenAI API (default)
export OPENAI_API_KEY="your-api-key-here"

# Ollama (for local models)
export OLLAMA_BASE_URL="http://localhost:11434"

Model Selection

from noctis.models.openai_adapter import OpenAIAdapter
from noctis.models.ollama_adapter import OllamaAdapter

# Use OpenAI models
agent = CodeReviewAgent("gpt-4")
agent = CodeReviewAgent("gpt-4o-mini")

# Use Ollama models
agent = CodeReviewAgent(OllamaAdapter(model="llama2"))
agent = CodeReviewAgent(OllamaAdapter(model="codellama"))

๐Ÿ“š Usage Examples

Code Review Agent

from noctis.predefined_agents import CodeReviewAgent

agent = CodeReviewAgent()

code_to_review = """
def process_user_data(user_input):
    query = "SELECT * FROM users WHERE id = " + user_input
    result = execute_query(query)
    return result
"""

response = agent.ask(f"""
Please review this code and identify:
1. Security vulnerabilities
2. Performance issues
3. Code quality improvements

Code:
{code_to_review}
""")

print(response)

Security Auditor Agent

from noctis.predefined_agents import SecurityAgent

agent = SecurityAgent()

flask_code = """
@app.route('/profile/<user_id>')
def profile(user_id):
    user = db.execute(f"SELECT * FROM users WHERE id = {user_id}").fetchone()
    return render_template('profile.html', user=user)
"""

response = agent.ask(f"""
Conduct a security audit of this Flask code:
{flask_code}

Focus on:
1. SQL injection vulnerabilities
2. Authentication/authorization issues
3. Specific remediation steps
""")

print(response)

Performance Optimizer Agent

from noctis.predefined_agents import PerformanceAgent

agent = PerformanceAgent()

slow_code = """
def find_duplicates(items):
    duplicates = []
    for i in range(len(items)):
        for j in range(i + 1, len(items)):
            if items[i] == items[j]:
                duplicates.append(items[i])
    return duplicates
"""

response = agent.ask(f"""
Analyze this code for performance issues:
{slow_code}

Suggest:
1. Algorithmic improvements
2. Data structure optimizations
3. Optimized versions
""")

print(response)

๐ŸŽฏ Advanced Usage

Custom Agent Creation

from noctis.predefined_agents import PredefinedAgent
from noctis.agent import Noctis
from noctis.memory.sqlite import SQLiteMemory

class CustomAgent(PredefinedAgent):
    def _setup_agent(self):
        system_prompt = """You are a specialized agent for [your domain]..."""
        
        self.agent = Noctis(
            model=self.model,
            memory=SQLiteMemory("custom_agent_memory.db")
        )
        
        # Override system prompt
        self.agent._messages = lambda text: [
            {"role": "system", "content": system_prompt},
            *self.agent.memory.get_recent(10),
            {"role": "user", "content": text}
        ]

# Use your custom agent
custom_agent = CustomAgent()
response = custom_agent.ask("Your question here")

Memory Management

from noctis.memory.sqlite import SQLiteMemory

# Create agent with custom memory
memory = SQLiteMemory("my_project_memory.db")
agent = CodeReviewAgent()
agent.agent.memory = memory

# Memory persists between sessions
response1 = agent.ask("What are the key principles of good code review?")
response2 = agent.ask("Can you elaborate on the second principle you mentioned?")

Tool Integration

from noctis.tools import get_registry, run_tool

# Check available tools
tools = get_registry()
print(f"Available tools: {list(tools.keys())}")

# Use web search tool
search_results = run_tool("web.search", {
    "query": "Python best practices 2024",
    "num_results": 5
})

# Use web fetch tool
content = run_tool("web.fetch", {
    "url": "https://example.com",
    "snippet_chars": 500
})

๐Ÿงช Testing

# Run all tests
python -m pytest tests/

# Run specific test file
python -m pytest tests/test_predefined_agents.py

# Run with coverage
python -m pytest --cov=noctis tests/

๐Ÿ“ Project Structure

noctis/
โ”œโ”€โ”€ noctis/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ agent.py              # Core agent functionality
โ”‚   โ”œโ”€โ”€ predefined_agents.py  # Specialized agents
โ”‚   โ”œโ”€โ”€ cli.py               # Command line interface
โ”‚   โ”œโ”€โ”€ tools.py             # Built-in tools
โ”‚   โ”œโ”€โ”€ models/              # AI model adapters
โ”‚   โ””โ”€โ”€ memory/              # Memory implementations
โ”œโ”€โ”€ examples/                 # Usage examples
โ”œโ”€โ”€ tests/                   # Test suite
โ”œโ”€โ”€ requirements.txt         # Dependencies
โ””โ”€โ”€ pyproject.toml          # Project configuration

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Adding New Agents

To add a new specialized agent:

  1. Create a new class inheriting from PredefinedAgent
  2. Implement the _setup_agent() method with a domain-specific system prompt
  3. Add the agent to the get_available_agents() function
  4. Write tests for the new agent
  5. Update documentation

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Built on top of OpenAI's GPT models and Ollama
  • Inspired by the need for specialized AI assistance in development workflows
  • Community contributions and feedback

๐Ÿ“ž Support


Happy coding with Noctis! ๐Ÿš€

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

noctis_ai-1.0.0.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

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

noctis_ai-1.0.0-py3-none-any.whl (20.1 kB view details)

Uploaded Python 3

File details

Details for the file noctis_ai-1.0.0.tar.gz.

File metadata

  • Download URL: noctis_ai-1.0.0.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for noctis_ai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 315d99419f4708be12c052c252b55e37568406cb34e61781a1f3cba46b1d9a54
MD5 285daf58c52c51b1fc1c05b4a3361265
BLAKE2b-256 aefa5fb5f56fb16a4dd84be4b28e8e2b5144eb5463f0e3e41fe0442af114a727

See more details on using hashes here.

File details

Details for the file noctis_ai-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: noctis_ai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 20.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for noctis_ai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e58fecb7c70066c628036191e1ed68c5f842259656e3c3fa246f786e859f09d2
MD5 a5a8cd82cf65f74ea98dd8e754534063
BLAKE2b-256 faed342e5541f94283c5057aa906f0c22353567445fcf71bdd6a57ea77718d16

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