Skip to content

enopax/provider-agent

Repository files navigation

Enopax Agent Provider

AI Agent Provisioning for Automated Infrastructure Management

Version Status License


Overview

The Agent Provider enables provisioning and management of AI agents for infrastructure automation. Powered by the @enopax/resource-api framework, it provides AI-powered infrastructure management as a service through the Enopax platform.

Features:

  • 🤖 Deploy AI agents for infrastructure automation
  • 🔧 Configure agent capabilities and permissions
  • 🧠 Integrate with Claude, OpenAI, or other LLM providers
  • ⚙️ Create custom agent workflows
  • 📊 Real-time monitoring and metrics

Status

✅ Server Ready - v0.1.0

  • ✅ Server implementation using @enopax/resource-api
  • ✅ Provider API integration complete
  • ✅ Settings page with JWT authentication
  • ✅ Bash script structure in place
  • 🚧 Agent container implementation (in progress)
  • 🚧 LLM API integration (pending)

Quick Start

Prerequisites

  • Node.js 18+ and pnpm
  • Docker (for agent containers)
  • LLM API keys (Claude or OpenAI)

Installation

# Clone repository
git clone https://github.com/enopax/provider-agent.git
cd provider-agent

# Install dependencies
pnpm install

# Start server
pnpm dev

# Server runs on http://localhost:3002

Verify Installation

# Test provider discovery
curl http://localhost:3002/providers/info | json_pp

# Expected output:
# {
#   "success": true,
#   "providers": [{
#     "typeId": "ai-agent",
#     "displayName": "AI Agent",
#     "endpoint": "/agents",
#     ...
#   }]
# }

Usage

Provisioning an Agent

Via Platform UI:

  1. Navigate to Resources → Create Resource
  2. Select "AI Agent" provider
  3. Configure agent settings:
    • Agent name
    • LLM provider (Claude/OpenAI)
    • Model selection
    • Capabilities
  4. Click "Provision"

Via API:

curl -X POST http://localhost:3002/v1/agents \
  -H "Content-Type: application/json" \
  -d '{
    "agentName": "cost-optimizer",
    "llmProvider": "claude",
    "model": "claude-3-5-sonnet-20250219",
    "capabilities": ["cost-analysis", "resource-monitoring"],
    "organizationId": "my_org",
    "projectId": "production"
  }'

Response:

{
  "success": true,
  "id": "my_org-production-cost_optimizer-abc123de",
  "name": "cost-optimizer",
  "status": "provisioning",
  "message": "Agent container created and starting",
  "endpoint": "http://localhost:8080/agent/abc123de"
}

Checking Agent Status

curl http://localhost:3002/v1/agents/my_org-production-cost_optimizer-abc123de

Response:

{
  "success": true,
  "id": "my_org-production-cost_optimizer-abc123de",
  "status": "active",
  "health": "healthy",
  "uptime": 86400,
  "metrics": {
    "tasksExecuted": 42,
    "recommendationsGenerated": 15
  }
}

Accessing Settings

Via Platform UI:

  1. Navigate to agent resource
  2. Click "Settings" button
  3. Platform requests JWT token
  4. Settings page opens in new window
  5. Configure agent parameters

JWT Token Flow:

# 1. Request token
curl -X POST http://localhost:3002/v1/agents/:id/settings/token \
  -H "Content-Type: application/json" \
  -d '{"userId": "user_123", "resourceId": ":id"}'

# 2. Receive token
{
  "url": "http://localhost:3002/v1/agents/:id/settings?token=JWT",
  "token": "eyJ...",
  "expiresAt": "2025-10-09T15:00:00Z"
}

# 3. Access settings page
open "http://localhost:3002/v1/agents/:id/settings?token=JWT"

Updating Agent Configuration

curl -X PUT http://localhost:3002/v1/agents/:id \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-3-opus-20240229",
    "capabilities": ["cost-analysis", "scaling-recommendations"]
  }'

Deprovisioning an Agent

curl -X DELETE http://localhost:3002/v1/agents/:id

Configuration

Agent Configuration

Agents are configured via JSON schema:

{
  "agentName": "infra-optimizer",
  "llmProvider": "claude",
  "model": "claude-3-5-sonnet-20250219",
  "capabilities": [
    "resource-monitoring",
    "cost-analysis",
    "scaling-recommendations",
    "log-analysis"
  ],
  "permissions": {
    "resources": ["ipfs-*", "postgres-*"],
    "actions": ["read", "recommend"]
  },
  "schedule": "0 */6 * * *"
}

Server Configuration

Server settings in server.js:

const app = createServer({
  port: 3002,                          // Server port
  host: 'localhost',                   // Server host
  authentication: {
    enabled: false,                     // Enable API key auth
    apiKey: process.env.API_KEY || ''  // API key
  },
  providers: [{
    apiVersion: 'v1',
    endpoint: '/agents',
    scriptsFolder: './provider/agent/scripts'
  }]
});

API Reference

Endpoints

Method Endpoint Description
GET /providers/info Discover provider metadata
GET /v1/agents?org=...&project=... List agents
POST /v1/agents Provision new agent
GET /v1/agents/:id Get agent status
GET /v1/agents/:id/metrics Get agent metrics
PUT /v1/agents/:id Update agent
DELETE /v1/agents/:id Deprovision agent
POST /v1/agents/:id/settings/token Generate settings token
GET /v1/agents/:id/settings?token=JWT Access settings page

Configuration Schema

See provider/agent/config.json for the complete JSON Schema.


Architecture

The Agent Provider uses a layered architecture:

  1. Server Layer: Express via @enopax/resource-api
  2. Provider Scripts: Bash scripts for lifecycle management
  3. Agent Containers: Docker containers running AI agents
  4. LLM Integration: API calls to Claude/OpenAI
  5. Custom Endpoints: Vue.js pages for configuration

See docs/architecture.md for detailed architecture documentation.


Project Structure

provider-agent/
├── server.js                  # Server using @enopax/resource-api
├── package.json               # Dependencies and scripts
├── provider/
│   └── agent/
│       ├── config.json        # Provider configuration
│       ├── scripts/           # Lifecycle scripts
│       │   ├── provision.sh
│       │   ├── list.sh
│       │   ├── status.sh
│       │   ├── metrics.sh
│       │   ├── update.sh
│       │   ├── deprovision.sh
│       │   └── settings/      # Settings endpoint scripts
│       │       ├── get-settings.sh
│       │       └── save-settings.sh
│       └── pages/             # Custom endpoint pages
│           └── settings/
│               ├── index.html
│               └── app.js
├── docs/
│   ├── concept.md            # Core concepts
│   └── architecture.md       # System architecture
├── CHANGELOG.md              # Version history
├── CLAUDE.md                 # AI assistant guidance
└── README.md                 # This file

Use Cases

Infrastructure Automation

  • Auto-scaling: Monitor usage and provision resources proactively
  • Self-healing: Detect failures and automatically remediate
  • Cost optimization: Identify underutilized resources and suggest optimizations

DevOps Assistance

  • Deployment automation: Orchestrate complex deployment workflows
  • Log analysis: Monitor logs and alert on anomalies
  • Performance tuning: Analyse metrics and suggest improvements

Compliance & Security

  • Security monitoring: Scan for vulnerabilities and unusual patterns
  • Compliance checking: Validate against policies and generate reports
  • Audit trail: Track all infrastructure changes

See docs/concept.md for detailed use cases.


Development

Prerequisites

  • Node.js 18+
  • pnpm
  • Docker Desktop
  • Git

Setup

# Clone repository
git clone https://github.com/enopax/provider-agent.git
cd provider-agent

# Install dependencies
pnpm install

# Start development server
pnpm dev

Testing Scripts

# Test provision script manually
echo '{"agentName":"test","llmProvider":"claude"}' | \
  bash provider/agent/scripts/provision.sh

# Test status script
echo '{"id":"org-proj-agent-abc123"}' | \
  bash provider/agent/scripts/status.sh

Running Tests

# Unit tests (when implemented)
pnpm test

# Integration tests (when implemented)
pnpm test:integration

Documentation


Security

Agent Isolation

  • Each agent runs in isolated Docker container
  • No host system access
  • Resource quotas and limits enforced

Permission Model

  • Explicit resource patterns (ipfs-*, postgres-*)
  • Action allow-list (read, recommend, update)
  • Approval workflow for sensitive actions

API Security

  • Optional API key authentication
  • JWT tokens for custom endpoints (5 min expiry)
  • Audit logging for all actions

See security considerations in docs/concept.md.


Roadmap

v0.2.0 (Next)

  • Agent container implementation
  • Claude API integration
  • Basic workflow execution
  • Docker deployment

v0.3.0

  • OpenAI API integration
  • Advanced workflow engine
  • Multi-agent coordination
  • Enhanced monitoring

v1.0.0

  • Production-ready deployment
  • Kubernetes support
  • Enterprise features
  • Comprehensive testing

See CHANGELOG.md for version history.


Contributing

Contributions welcome! Please:

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

Follow semantic commit messages and PR specifications.


Support


License

MIT


Acknowledgements


Status: Server ready • Agent implementation in progress • v0.1.0

About

AI agent provisioning for automated infrastructure management

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors