Skip to content

ivproduced/SYSAdmin-CoPilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

1 Commit
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ Copilot SDK Control Plane

Agent-Native Infrastructure Management via GitHub Copilot SDK

Give Copilot hands to manage your infrastructure. Ask questions in natural language, get real system data back. Built for the GitHub Copilot SDK Mini Hackathon.


๐ŸŽฏ What Is This?

An AI-powered control plane where GitHub Copilot acts as the reasoning engine, orchestrating real system operations through secure tool gateways.

Not a chatbot with AI features. An agent-native system where Copilot is the brain.

Example Queries:

  • "What's my system status?" โ†’ Gets CPU, RAM, disk usage, uptime
  • "Show me running processes" โ†’ Lists processes with CPU/memory usage
  • "Check disk space" โ†’ Reports disk usage across partitions
  • "What's my network status?" โ†’ Shows interface stats and traffic

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Web Interface  โ”‚  โ† You interact here (browser/mobile)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Copilot Agent   โ”‚  โ† GitHub Copilot SDK (planning & reasoning)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Tool Gateway   โ”‚  โ† Security layer (permissions, validation, audit)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
         โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  System Tools   โ”‚  โ† Your custom tools (API calls, DB queries, etc.)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Clean Separation:

  1. Interface Layer: Pure UI - no logic, just displays results
  2. Agent Layer: Copilot SDK handles all reasoning and planning
  3. Gateway Layer: Security boundary with permission checks and audit logging
  4. Tool Layer: Small, deterministic operations (yours to customize!)

โšก Quick Start

1. Install Dependencies

pip install github-copilot-sdk fastapi uvicorn psutil aiofiles sse-starlette aiohttp

2. Copy Example Config

cp config.example.py config.py

3. Start the Server

python server.py

4. Open the Interface

Visit http://localhost:8000 in your browser!


๐Ÿ› ๏ธ Customization

Adding Your Own Tools

  1. Create a tool file (e.g., my_tools.py):
async def check_api_health(params: dict, context: dict) -> str:
    """Check if my API is healthy"""
    import aiohttp
    async with aiohttp.ClientSession() as session:
        async with session.get("https://myapi.com/health") as resp:
            if resp.status == 200:
                return "โœ… API is healthy!"
            return f"โŒ API returned {resp.status}"
  1. Register in config.py:
from my_tools import check_api_health

TOOLS = [
    check_api_health,
    # ... other tools
]
  1. Restart the server - Copilot now knows about your tool!

Tool Signature

All tools must follow this signature:

async def tool_name(params: Dict[str, Any], context: Dict[str, Any]) -> str:
    """
    Tool description - Copilot sees this!
    
    Permission: READ or WRITE or ADMIN
    Parameters:
        param_name (type): Description
    """
    # Your code here
    return "Result string that Copilot will see"

๐Ÿ” Security

Tool Gateway

Every tool call goes through the security gateway which:

  • โœ… Validates permissions (READ/WRITE/ADMIN)
  • โœ… Checks input schemas
  • โœ… Logs all executions
  • โœ… Handles errors gracefully

Audit Logs

All tool executions are logged to ~/.copilot-ops/logs/audit_YYYYMMDD.jsonl:

{
  "timestamp": "2026-01-25T07:00:00.123456",
  "tool_name": "get_system_info",
  "params": {},
  "success": true,
  "duration_ms": 45.2,
  "output": "๐Ÿ–ฅ๏ธ System Status..."
}

๐Ÿ“ Project Structure

sysadmin-copilot/
โ”œโ”€โ”€ server.py              # FastAPI web server
โ”œโ”€โ”€ copilot_agent.py       # Copilot SDK integration
โ”œโ”€โ”€ tool_gateway.py        # Security layer
โ”œโ”€โ”€ system_tools.py        # Example system monitoring tools
โ”œโ”€โ”€ config.example.py      # Configuration template
โ”œโ”€โ”€ config.py             # Your config (gitignored)
โ”œโ”€โ”€ .internal/            # Your private tools (gitignored)
โ”œโ”€โ”€ README.md             # This file
โ””โ”€โ”€ REDDIT_POST.md        # Hackathon submission details

๐ŸŽฎ Example Use Cases

DevOps Automation

"Restart the nginx service"
"Check if port 8080 is open"
"Show me the last 50 lines of error logs"

Database Management

"How many users are in the database?"
"Show me slow queries from today"
"Check database connection pool status"

Infrastructure Monitoring

"Which servers have high CPU?"
"Show me Docker containers that are down"
"Check GPU utilization across the fleet"

Custom APIs

"Get the status of my microservices"
"Check if the payment API is responding"
"Show me today's API error rate"

๐Ÿง  How It Works

1. You Ask a Question

"What's my system doing?"

2. Copilot Plans

The SDK analyzes your question and decides which tools to use:

  • get_system_info - get CPU/RAM/disk
  • list_processes - show running processes

3. Tools Execute

Gateway validates permissions and runs the tools.

4. Copilot Synthesizes

SDK combines results into a human-readable response:

"Your system is running well! CPU at 23%, 16GB RAM used (42%), disk 65% full. Top processes: Chrome (8%), Python (3%), Docker (2%)..."


๐Ÿ”ง Advanced Configuration

Permissions

Control what Copilot can do by setting tool permissions:

from tool_gateway import ToolPermission

# Read-only (safe)
permission=ToolPermission.READ

# Can modify data (use carefully)
permission=ToolPermission.WRITE  

# System administration (dangerous!)
permission=ToolPermission.ADMIN

Streaming Responses

The server uses Server-Sent Events (SSE) for real-time streaming. Copilot's thinking appears as it happens!

Multiple Tool Calls

Copilot can chain multiple tools to answer complex questions. It handles this automatically based on your tool descriptions.


๐Ÿ“Š Built With

  • GitHub Copilot SDK (v0.1.18) - Agent framework
  • FastAPI - Async web framework
  • Python 3.11+ - Async/await throughout
  • psutil - System monitoring
  • aiohttp - Async HTTP client

๐ŸŽฅ Demo

[Video coming soon - will show natural language queries, real-time monitoring, and multi-tool reasoning]


๐Ÿšง Roadmap

  • Voice interface integration
  • Proactive monitoring (agent alerts you)
  • Write operations with confirmation prompts
  • Multi-agent orchestration
  • Mobile app with push notifications
  • Docker deployment

๐Ÿค Contributing

This started as a hackathon project but there's so much potential! Ideas welcome:

  • More example tools
  • Better error handling
  • UI improvements
  • Documentation

๐Ÿ“ License

MIT License - see LICENSE file


๐Ÿ™ Acknowledgments

Built for the GitHub Copilot SDK Mini Hackathon. Thanks to the Copilot team for an amazing SDK!

Special thanks to the community for inspiration and support.


โ“ FAQ

Q: Is this safe to use?
A: Yes, with proper permissions! Start with READ-only tools. Add WRITE/ADMIN tools carefully and review audit logs.

Q: Can I use this in production?
A: It's hackathon-quality code, but the architecture is solid. Add authentication, rate limiting, and hardening for production.

Q: Does it work on Windows/Mac/Linux?
A: Yes! System tools use cross-platform libraries (psutil).

Q: Can I connect to external APIs?
A: Absolutely! Write async functions that call any API, database, or service.

Q: How do I secure this?
A: Use Tailscale for network security, implement authentication, review tool permissions, monitor audit logs.


Questions? Open an issue or reach out! ๐Ÿš€

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages