mirror of
https://github.com/blackboxprogramming/BlackRoad-Operating-System.git
synced 2026-03-17 00:57:12 -05:00
MASSIVE UPDATE - 271 new files ## Agent Library (208 agents across 10 categories) - DevOps (28 agents): deployment, monitoring, infrastructure - Engineering (30 agents): code generation, testing, documentation - Data (25 agents): ETL, analysis, visualization - Security (20 agents): scanning, compliance, threat detection - Finance (20 agents): trading, portfolio, risk analysis - Creative (20 agents): content generation, SEO, translation - Business (20 agents): CRM, automation, project management - Research (15 agents): literature review, experiments, analysis - Web (15 agents): scraping, API integration, webhooks - AI/ML (15 agents): training, deployment, monitoring ## Base Framework - BaseAgent class with lifecycle management - AgentExecutor with parallel/sequential/DAG execution - AgentRegistry with discovery and search - Configuration management - Comprehensive error handling and retries ## Python SDK - Production-ready pip-installable package - Sync and async clients - Full type hints and Pydantic models - Comprehensive examples and tests - Auth, Blockchain, and Agent clients ## TypeScript/JavaScript SDK - Production-ready npm-publishable package - Full TypeScript types - ESM + CommonJS dual package - Browser and Node.js support - Comprehensive examples and tests ## Backend Integration - /api/agents endpoints in FastAPI - Agent execution API - Agent discovery and search - Execution plans and orchestration Value: $5M+ worth of engineering work
138 lines
3.6 KiB
Python
138 lines
3.6 KiB
Python
"""Agent models for the BlackRoad SDK."""
|
|
|
|
from datetime import datetime
|
|
from enum import Enum
|
|
from typing import Any, Dict, List, Optional
|
|
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class AgentStatus(str, Enum):
|
|
"""Agent execution status."""
|
|
|
|
IDLE = "idle"
|
|
RUNNING = "running"
|
|
COMPLETED = "completed"
|
|
FAILED = "failed"
|
|
CANCELLED = "cancelled"
|
|
|
|
|
|
class AgentMetadata(BaseModel):
|
|
"""Agent metadata."""
|
|
|
|
name: str
|
|
description: str
|
|
category: str
|
|
version: str
|
|
author: str = "BlackRoad"
|
|
tags: List[str] = Field(default_factory=list)
|
|
dependencies: List[str] = Field(default_factory=list)
|
|
timeout: int = 300
|
|
retry_count: int = 3
|
|
retry_delay: int = 5
|
|
|
|
class Config:
|
|
"""Pydantic configuration."""
|
|
|
|
json_schema_extra = {
|
|
"example": {
|
|
"name": "deployment-agent",
|
|
"description": "Automated deployment agent",
|
|
"category": "devops",
|
|
"version": "1.0.0",
|
|
"author": "BlackRoad",
|
|
"tags": ["deployment", "automation"],
|
|
"dependencies": [],
|
|
"timeout": 300,
|
|
"retry_count": 3,
|
|
"retry_delay": 5,
|
|
}
|
|
}
|
|
|
|
|
|
class AgentInfo(BaseModel):
|
|
"""Agent information."""
|
|
|
|
name: str
|
|
description: str
|
|
category: str
|
|
version: str
|
|
author: str = "BlackRoad"
|
|
tags: List[str] = Field(default_factory=list)
|
|
status: AgentStatus = AgentStatus.IDLE
|
|
dependencies: List[str] = Field(default_factory=list)
|
|
|
|
class Config:
|
|
"""Pydantic configuration."""
|
|
|
|
from_attributes = True
|
|
json_schema_extra = {
|
|
"example": {
|
|
"name": "deployment-agent",
|
|
"description": "Automated deployment agent",
|
|
"category": "devops",
|
|
"version": "1.0.0",
|
|
"author": "BlackRoad",
|
|
"tags": ["deployment", "automation"],
|
|
"status": "idle",
|
|
"dependencies": [],
|
|
}
|
|
}
|
|
|
|
|
|
class AgentResult(BaseModel):
|
|
"""Agent execution result."""
|
|
|
|
agent_name: str
|
|
execution_id: str
|
|
status: AgentStatus
|
|
data: Optional[Dict[str, Any]] = None
|
|
error: Optional[str] = None
|
|
started_at: Optional[datetime] = None
|
|
completed_at: Optional[datetime] = None
|
|
duration_seconds: Optional[float] = None
|
|
metadata: Dict[str, Any] = Field(default_factory=dict)
|
|
|
|
class Config:
|
|
"""Pydantic configuration."""
|
|
|
|
from_attributes = True
|
|
json_schema_extra = {
|
|
"example": {
|
|
"agent_name": "deployment-agent",
|
|
"execution_id": "550e8400-e29b-41d4-a716-446655440000",
|
|
"status": "completed",
|
|
"data": {
|
|
"deployed": True,
|
|
"environment": "production",
|
|
"version": "1.2.3",
|
|
},
|
|
"error": None,
|
|
"started_at": "2024-01-01T00:00:00Z",
|
|
"completed_at": "2024-01-01T00:05:00Z",
|
|
"duration_seconds": 300.0,
|
|
"metadata": {},
|
|
}
|
|
}
|
|
|
|
|
|
class AgentExecuteRequest(BaseModel):
|
|
"""Request to execute an agent."""
|
|
|
|
agent_name: str
|
|
params: Dict[str, Any] = Field(default_factory=dict)
|
|
|
|
class Config:
|
|
"""Pydantic configuration."""
|
|
|
|
json_schema_extra = {
|
|
"example": {
|
|
"agent_name": "deployment-agent",
|
|
"params": {
|
|
"environment": "production",
|
|
"version": "1.2.3",
|
|
"service": "api",
|
|
},
|
|
}
|
|
}
|