diff --git a/.bob/01-project-overview.md b/.bob/01-project-overview.md index c77ef7c..a958443 100644 --- a/.bob/01-project-overview.md +++ b/.bob/01-project-overview.md @@ -87,13 +87,6 @@ Collections of tests/conversations that can be executed together: - **Language**: TypeScript - **Role**: Job poller and external API executor -### Agent Service (Python) - -- **Framework**: FastAPI -- **Language**: Python -- **Role**: CrewAI execution (currently out of date) -- **Status**: Present in the repo but not the primary maintained execution path - ### Shared Packages - **@ibm-vibe/types** - Shared TypeScript types @@ -107,7 +100,6 @@ ai-agent-testing-suite/ ├── frontend/ # Next.js UI ├── backend/ # Express API server ├── agent-service-api/ # Job poller & external API executor -├── agent-service/ # Python FastAPI (CrewAI) ├── packages/ # Shared packages │ ├── types/ # Shared TypeScript types │ ├── config/ # Configuration management @@ -144,7 +136,6 @@ ai-agent-testing-suite/ - Run conversations/tests individually or in batches - Execute with different agent versions - Route `external_api` jobs through `agent-service-api` -- Keep legacy CrewAI compatibility through the older Python service path - Use a backend job queue for asynchronous execution ### Results Analysis @@ -166,9 +157,8 @@ The project is currently in a **legacy-to-conversation migration phase**: ## Port Configuration -| Service | Default Port | Role | -| ---------------------- | -----------: | -------------------------------------------- | -| Frontend | 3000 | UI for conversations, sessions, and analysis | -| Backend | 5100 | System API, storage, job orchestration | -| Agent Service API | 5003 | External API executor and backend job poller | -| Agent Service (Python) | 5002 | CrewAI execution service | +| Service | Default Port | Role | +| ----------------- | -----------: | -------------------------------------------- | +| Frontend | 3000 | UI for conversations, sessions, and analysis | +| Backend | 5100 | System API, storage, job orchestration | +| Agent Service API | 5003 | External API executor and backend job poller | diff --git a/.bob/02-architecture.md b/.bob/02-architecture.md index 8b2e1ff..6da4409 100644 --- a/.bob/02-architecture.md +++ b/.bob/02-architecture.md @@ -2,7 +2,7 @@ ## High-Level Architecture -The IBM VIBE system consists of a Next.js frontend, an Express/SQLite backend, a TypeScript external API executor, and an older Python CrewAI service. The TypeScript path is the primary maintained execution path. +The IBM VIBE system consists of a Next.js frontend, an Express/SQLite backend, and a TypeScript external API executor. ``` ┌─────────────────────────────────────────────────────────────┐ @@ -20,10 +20,6 @@ The IBM VIBE system consists of a Next.js frontend, an Express/SQLite backend, a │ │Database │ │ │ └─────────┘ │ │ │ -│ Optional: ┌──────────────────┐ │ -│ │ Agent Service │ │ -│ │ (Python/CrewAI) │ │ -│ └──────────────────┘ │ └─────────────────────────────────────────────────────────────┘ ``` @@ -151,22 +147,7 @@ agent-service-api/src/ └── routes/ # Health check endpoints ``` -### 4. Agent Service (Python) (`agent-service/`) - -**Technology**: FastAPI, Python, CrewAI - -**Status**: Present in the repo but not the primary maintained execution path - -**Responsibilities**: - -- Execute CrewAI agent workflows -- Support for various LLM providers -- Detailed logging of intermediate steps -- Metrics collection - -**Note**: The TypeScript path (backend + agent-service-api) is the primary maintained execution path. - -### 5. Shared Packages (`packages/`) +### 4. Shared Packages (`packages/`) **@ibm-vibe/types**: @@ -252,7 +233,6 @@ Meanwhile: localhost:3000 → Frontend (Next.js dev server) localhost:5100 → Backend (ts-node-dev) localhost:5003 → Agent Service API (ts-node-dev) -localhost:5002 → Agent Service Python (optional) ``` ### Production Considerations diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e614d10..d047c0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,26 +39,6 @@ jobs: - name: Run TypeScript tests run: npm run test:ts - python-quality-gates: - name: Python quality gates - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Python - uses: actions/setup-python@v5 - with: - python-version: '3.11' - - - name: Install Python dependencies - run: python -m pip install --upgrade pip && pip install -r agent-service/requirements.txt - - - name: Run Python tests - run: pytest agent-service/tests - dco-check: if: ${{ github.event_name == 'pull_request' }} name: DCO signoff check diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 768b35e..e17d1b6 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -12,7 +12,6 @@ This project is organized as a monorepo with the following components: ai-agent-testing-suite/ ├── frontend/ # Next.js user interface ├── backend/ # Express.js API server -├── agent-service/ # Python FastAPI service for CrewAI agents ├── agent-service-api/ # TypeScript Express communication layer └── docs/ # Documentation and diagrams ``` @@ -23,7 +22,7 @@ ai-agent-testing-suite/ Mermaid source: [`docs/diagrams/high-level-component-diagram.mermaid`](docs/diagrams/high-level-component-diagram.mermaid) -The system consists of four main components: +The system consists of three main components: ### 1. Frontend (`frontend/`) @@ -50,22 +49,7 @@ The system consists of four main components: - Agent service factory for handling different agent types - Support for external API integration -### 3. Agent Service (`agent-service/`) - -**Technology Stack:** Python, FastAPI, CrewAI - -**Key Features:** - -- Agent execution using CrewAI framework -- Support for various LLM providers (currently Ollama) -- Detailed logging of intermediate steps -- Metrics collection (token usage, model calls, etc.) -- Configurable agent settings (role, goal, backstory, etc.) -- Support for tools and delegation - -**Status note:** The Python `agent-service` is currently out of date and needs TLC. The primary maintained execution path is `backend` + `agent-service-api`. - -### 4. Agent Service API (`agent-service-api/`) +### 3. Agent Service API (`agent-service-api/`) **Technology Stack:** TypeScript, Express.js @@ -88,10 +72,8 @@ The system supports two main types of agents: ### 1. CrewAI Agents -- Configured with role, goal, and backstory -- Support for tools and delegation -- LLM configuration (model, temperature, etc.) -- Memory and code execution options +- The `crewai` settings type is still accepted and stored by the backend +- No service currently executes these jobs: the Python CrewAI service has been removed, and `agent-service-api` only runs `external_api` jobs ### 2. External API Agents @@ -139,12 +121,6 @@ The system uses SQLite for data persistence with the following key entities (leg - **Purpose:** Execute external API conversations/tests - **Data:** Formatted requests, mapped responses, usage metadata -### Backend ↔ Agent Service (Python) - -- **Protocol:** HTTP API (FastAPI) -- **Purpose:** Direct CrewAI execution path (optional/legacy-maintained) -- **Data:** Agent configurations, conversation/test inputs, execution outputs - ### Backend ↔ Database - **Protocol:** SQLite (better-sqlite3) @@ -163,7 +139,6 @@ The system uses SQLite for data persistence with the following key entities (leg - **Frontend**: Static site deployment (Vercel, Netlify) - **Backend**: Node.js server deployment -- **Agent Service**: Python ASGI server deployment - **Database**: SQLite file-based storage - **Monitoring**: Log aggregation and performance monitoring @@ -172,7 +147,6 @@ The system uses SQLite for data persistence with the following key entities (leg - Use sentence capitalization for strings (including titles) - Add new line at the end of files - Follow TypeScript/JavaScript best practices -- Use Python PEP 8 for Python components ## Diagrams diff --git a/MULTI_INSTANCE_DEPLOYMENT.md b/MULTI_INSTANCE_DEPLOYMENT.md index b617c2e..4676c9a 100644 --- a/MULTI_INSTANCE_DEPLOYMENT.md +++ b/MULTI_INSTANCE_DEPLOYMENT.md @@ -10,7 +10,7 @@ The deployment system consists of: - **Helper scripts**: Stop, view logs, and check status of instances - **Environment files**: Configuration for each instance (ports, database paths, etc.) -By default, `start-instance.sh` manages backend, agent-service-api, and frontend. The Python agent-service commands are present in the script but commented out. +By default, `start-instance.sh` manages backend, agent-service-api, and frontend. ## Prerequisites @@ -25,9 +25,6 @@ By default, `start-instance.sh` manages backend, agent-service-api, and frontend ```bash # Install root dependencies (links workspaces) npm install - - # Agent Service (Python) - cd agent-service && pip install -r requirements.txt && cd .. ``` ## Port Allocation @@ -38,7 +35,7 @@ By default, `start-instance.sh` manages backend, agent-service-api, and frontend | instance2 | 5010 | 5011 | 5013 | 3010 | `./data/agent-testing-instance2.db` | | instance3 | 5020 | 5021 | 5023 | 3020 | `./data/agent-testing-instance3.db` | -`Agent Service` ports are reserved for the optional Python service if you enable it in `start-instance.sh`. +`Agent Service` ports are used by `start-instance.sh` to set `AGENT_SERVICE_URL` for the backend. No Python service runs on them. ## Quick Start @@ -267,9 +264,8 @@ If you get database errors: Common issues: 1. **Backend**: Missing `npm install` or wrong working directory -2. **Agent Service**: Missing Python dependencies or wrong working directory -3. **Agent Service API**: Missing `npm install` or wrong working directory -4. **Frontend**: Missing `npm install` or wrong working directory +2. **Agent Service API**: Missing `npm install` or wrong working directory +3. **Frontend**: Missing `npm install` or wrong working directory ## Advanced Configuration diff --git a/README.md b/README.md index 3217ffb..a88ba30 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,6 @@ Add `--json` to any command for clean JSON stdout. Exit codes: `0` success, `1` Optional: -- Python `3.10+` only if you are working on the legacy CrewAI service - Ollama or another local LLM only if your selected agent path requires it ### Start the maintained TypeScript stack @@ -144,14 +143,13 @@ Legacy test and suite flows still exist for compatibility, but new work should p The repository is an npm workspace monorepo: -| Workspace | Technology | Purpose | -| ------------------- | --------------------------- | ------------------------------------------------------ | -| `frontend` | Next.js, TypeScript, Carbon | Web UI for evaluation workflows | -| `backend` | Express, TypeScript, SQLite | API, persistence, job orchestration | -| `agent-service-api` | Express, TypeScript | Polls backend jobs and executes external API agents | -| `packages/vibe-cli` | TypeScript | CLI for scripting against a VIBE deployment | -| `packages/*` | TypeScript | Shared contracts, config, and utilities | -| `agent-service` | Python, FastAPI, CrewAI | Legacy CrewAI path; currently not the maintained stack | +| Workspace | Technology | Purpose | +| ------------------- | --------------------------- | --------------------------------------------------- | +| `frontend` | Next.js, TypeScript, Carbon | Web UI for evaluation workflows | +| `backend` | Express, TypeScript, SQLite | API, persistence, job orchestration | +| `agent-service-api` | Express, TypeScript | Polls backend jobs and executes external API agents | +| `packages/vibe-cli` | TypeScript | CLI for scripting against a VIBE deployment | +| `packages/*` | TypeScript | Shared contracts, config, and utilities | Key integration path: @@ -159,7 +157,7 @@ Key integration path: Frontend -> Backend -> Job queue -> Agent Service API -> Backend -> Sessions/transcripts ``` -The Python `agent-service` is not started by `npm run dev`. Prefer `backend` + `agent-service-api` unless you are explicitly working on CrewAI integration. +The Python `agent-service` was removed. The maintained stack is `backend` + `agent-service-api`. ## Development diff --git a/agent-service/.env.example b/agent-service/.env.example deleted file mode 100644 index b64c8cd..0000000 --- a/agent-service/.env.example +++ /dev/null @@ -1,11 +0,0 @@ -# Model Provider Configuration -MODEL_PROVIDER_URL= -MODEL_PROVIDER_API_KEY= -OLLAMA_BASE_URL=http://localhost:11434 - -# Service Configuration -PORT=5002 -HOST=0.0.0.0 - -# Other API Keys (if needed) -OTHER_TOOL_API_KEYS= \ No newline at end of file diff --git a/agent-service/.gitignore b/agent-service/.gitignore deleted file mode 100644 index 672f009..0000000 --- a/agent-service/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -# Python virtual environment -venv/ -env/ -ENV/ - -# Python bytecode -__pycache__/ -*.py[cod] -*$py.class - -# Distribution / packaging -dist/ -build/ -*.egg-info/ - -# Environment variables -.env -.env.* -!.env.example - -# IDE specific files -.idea/ -.vscode/ -*.swp -*.swo - -# Operating System -.DS_Store -Thumbs.db - -# Logs -*.log -logs/ \ No newline at end of file diff --git a/agent-service/README.md b/agent-service/README.md deleted file mode 100644 index b4832ef..0000000 --- a/agent-service/README.md +++ /dev/null @@ -1,226 +0,0 @@ -# AI Agent Testing Service - -This service is part of the AI Agent Testing Suite. It provides a Python-based service that executes AI agent tests using CrewAI, handling agent configuration, test execution, and result collection. - -## Status note - -This Python `agent-service` implementation is currently out of date and needs TLC. For active development and production-like flows, prefer the TypeScript execution path (`backend` + `agent-service-api`) unless you are explicitly working on CrewAI internals. - -## Overview - -The service provides: - -- Agent execution using CrewAI -- Test execution with configurable parameters -- Detailed logging of intermediate steps -- Metrics collection (token usage, model calls, etc.) - -## Requirements - -- Python 3.10 or higher -- pip (Python package installer) -- Ollama (for local LLM execution) - -## Setup - -1. Create a Python virtual environment: - -```bash -# Navigate to the agent-service directory -cd agent-service - -# Create virtual environment -python -m venv venv - -# Activate virtual environment -# On Linux/Mac: -source venv/bin/activate -# On Windows: -.\venv\Scripts\activate -``` - -2. Install dependencies: - -```bash -pip install -r requirements.txt -``` - -3. Set up environment variables: - -```bash -# Copy the example environment file -cp .env.example .env - -# Edit .env file with your configuration: -# - MODEL_PROVIDER_URL: URL of your model provider (optional for development) -# - MODEL_PROVIDER_API_KEY: Your API key (optional for development) -# - PORT: Service port (default: 5002) -# - HOST: Service host (default: 0.0.0.0) -``` - -4. Ensure Ollama is running: - -The service currently uses Ollama for LLM execution. By default, it connects to `http://localhost:11434`. You can modify this in the `models.py` file or through environment variables. - -## Running the Service - -1. Activate virtual environment (if not already activated): - -```bash -# On Linux/Mac: -source venv/bin/activate -# On Windows: -.\venv\Scripts\activate -``` - -2. Start the service: - -```bash -# From the agent-service directory: -python run.py -``` - -The service will start on http://localhost:5002 (or your configured PORT). - -## API Endpoints - -### Health Check - -``` -GET /health -Response: { "status": "ok" } -``` - -### Execute Test - -``` -POST /execute-test -Body: { - "agent_configs": [{ - "role": string, - "goal": string, - "backstory": string, - "allow_delegation": boolean, - "allow_code_execution": boolean, - "memory": boolean, - "verbose": boolean, - "tools": string[], - "llm_config": { - "provider": string, - "model": string, - "temperature": number, - "max_tokens": number, - "base_url": string - } - }], - "crew_config": { - "process": "sequential" | "hierarchical", - "async_execution": boolean, - "max_retries": number - }, - "test_input": string -} - -Response: { - "agent_id": number, - "test_id": number, - "output": string, - "success": boolean, - "execution_time": number, - "intermediate_steps": [ - { - "timestamp": string, - "agent_id": number, - "action": string, - "output": string - } - ], - "metrics": { - "token_usage": number, - "model_calls": number, - "tool_calls": number - } -} -``` - -## Testing the API - -You can test the API using curl or any API client like Postman: - -```bash -# Health check -curl http://localhost:5002/health - -# Execute test -curl -X POST http://localhost:5002/execute-test \ - -H "Content-Type: application/json" \ - -d '{ - "agent_configs": [{ - "role": "Research Assistant", - "goal": "Find accurate information", - "backstory": "You are an AI research assistant helping with information gathering.", - "allow_delegation": false, - "allow_code_execution": false, - "memory": false, - "verbose": true, - "tools": [], - "llm_config": { - "provider": "ollama", - "model": "llama2", - "temperature": 0.7, - "max_tokens": 1000, - "base_url": "http://localhost:11434" - } - }], - "crew_config": { - "process": "sequential", - "async_execution": true, - "max_retries": 3 - }, - "test_input": "What is the capital of France?" - }' -``` - -## CrewAI Integration - -This service uses CrewAI to create and manage AI agents. The main components are: - -- **Agents**: Defined with roles, goals, and backstories -- **Tasks**: Work items assigned to agents -- **Crew**: A collection of agents working together on tasks - -The service currently supports Ollama as the LLM provider, with plans to expand to other providers in the future. - -## Development Notes - -### TODO - -- [ ] Implement non-blocking execution for long-running tests - - Current implementation blocks until test completion - - Future: Implement background task processing with status tracking -- [ ] Add tool configuration support beyond the basic list of tool names -- [ ] Implement proper test ID handling and tracking -- [ ] Add proper success criteria implementation (currently always returns true) -- [ ] Enhance multiple agent handling (currently only uses the first agent for tasks) -- [ ] Improve error handling and logging -- [ ] Add support for additional LLM providers beyond Ollama -- [ ] Fix async/non-async execution mismatch in the agent_executor.py -- [ ] Add configuration option for the default Ollama URL - -## Project Structure - -``` -agent-service/ -├── src/ -│ ├── main.py # FastAPI application entry point -│ ├── agent_executor.py # Core agent execution logic -│ ├── config.py # Configuration handling -│ ├── models.py # Data models -│ ├── config/ # Additional configuration files -│ └── models/ # Additional model definitions -├── tests/ # Test files -├── run.py # Service entry point -├── requirements.txt # Python dependencies -├── .env.example # Example environment variables -└── README.md # This file -``` diff --git a/agent-service/requirements.txt b/agent-service/requirements.txt deleted file mode 100644 index 8bbed61..0000000 --- a/agent-service/requirements.txt +++ /dev/null @@ -1,12 +0,0 @@ -setuptools>=68.0.0 -crewai>=0.11.0 -crewai[tools]>=0.11.0 -fastapi>=0.104.0 -uvicorn>=0.24.0 -python-dotenv>=1.0.0 -pydantic>=2.4.2 -pydantic-settings>=2.0.0 -httpx>=0.25.0 -langchain-community>=0.0.10 -aiohttp>=3.8.0 -pytest>=8.3.0 diff --git a/agent-service/run.py b/agent-service/run.py deleted file mode 100644 index 90c517a..0000000 --- a/agent-service/run.py +++ /dev/null @@ -1,24 +0,0 @@ -import uvicorn -import logging -from src.config import settings - -# Configure logging -logging.basicConfig( - level=logging.DEBUG, - format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', - handlers=[ - logging.StreamHandler(), - logging.FileHandler('agent-service.log') - ] -) -logger = logging.getLogger(__name__) - -if __name__ == "__main__": - logger.info(f"Starting agent service on {settings.HOST}:{settings.PORT}") - uvicorn.run( - "src.main:app", - host=settings.HOST, - port=settings.PORT, - reload=True, - log_level="debug" - ) diff --git a/agent-service/src/agent_executor.py b/agent-service/src/agent_executor.py deleted file mode 100644 index b5bac34..0000000 --- a/agent-service/src/agent_executor.py +++ /dev/null @@ -1,125 +0,0 @@ -from crewai import Agent, Task, Crew -from datetime import datetime -import time -import logging -import traceback -from typing import List -from langchain_community.llms import Ollama - -from .models import AgentConfig, CrewConfig, TestExecutionResponse, IntermediateStep, Metrics - -# Get logger -logger = logging.getLogger(__name__) - -class AgentExecutor: - def __init__(self): - self.intermediate_steps: List[IntermediateStep] = [] - self.metrics = { - "token_usage": 0, - "model_calls": 0, - "tool_calls": 0 - } - - def _create_agent(self, config: AgentConfig) -> Agent: - """Create a CrewAI agent from configuration.""" - try: - # Create Ollama LLM instance - llm = Ollama( - model=config.llm_config.model, - temperature=config.llm_config.temperature, - base_url=config.llm_config.base_url - ) - - agent = Agent( - role=config.role, - goal=config.goal, - backstory=config.backstory, - allow_delegation=config.allow_delegation, - allow_code_execution=config.allow_code_execution, - memory=config.memory, - verbose=config.verbose, - llm=llm # Use the Ollama LLM instance - ) - - return agent - except Exception as e: - error_traceback = traceback.format_exc() - logger.error(f"Error creating agent: {str(e)}") - logger.error(f"Traceback: {error_traceback}") - raise - - def _log_step(self, agent_id: int, action: str, output: str): - """Log an intermediate step.""" - try: - step = IntermediateStep( - timestamp=datetime.utcnow().isoformat(), - agent_id=agent_id, - action=action, - output=output - ) - self.intermediate_steps.append(step) - except Exception as e: - logger.error(f"Error logging step: {str(e)}") - # Create a simplified step if there's an error - step = IntermediateStep( - timestamp=datetime.utcnow().isoformat(), - agent_id=agent_id, - action="error", - output=f"Error logging step: {str(e)}" - ) - self.intermediate_steps.append(step) - - def execute_test( - self, - agent_configs: List[AgentConfig], - crew_config: CrewConfig, - test_input: str, - test_id: int - ) -> TestExecutionResponse: - """Execute a test with the given configuration.""" - start_time = time.time() - - try: - # Create agents - agents = [self._create_agent(config) for config in agent_configs] - - # Create task - task = Task( - description=test_input, - agent=agents[0] # For now, assign to first agent - ) - - # Create crew - crew = Crew( - agents=agents, - tasks=[task], - process=crew_config.process, - async_execution=crew_config.async_execution, - max_retries=crew_config.max_retries - ) - - # Execute - Note: crew.kickoff() returns a string, not a coroutine - result = crew.kickoff() # Removed await since it's not async - - # Calculate execution time - execution_time = time.time() - start_time - - # Create response - response = TestExecutionResponse( - agent_id=1, # TODO: Handle multiple agents - test_id=test_id, - output=result, - success=True, # TODO: Implement success criteria - execution_time=execution_time, - intermediate_steps=self.intermediate_steps, - metrics=Metrics(**self.metrics) - ) - - return response - - except Exception as e: - error_traceback = traceback.format_exc() - logger.error(f"Error in execute_test: {str(e)}") - logger.error(f"Traceback: {error_traceback}") - self._log_step(0, "error", f"{str(e)}\n{error_traceback}") - raise diff --git a/agent-service/src/config.py b/agent-service/src/config.py deleted file mode 100644 index 332e520..0000000 --- a/agent-service/src/config.py +++ /dev/null @@ -1,19 +0,0 @@ -from pydantic_settings import BaseSettings -from typing import Optional - -class Settings(BaseSettings): - # Model Provider Settings - MODEL_PROVIDER_URL: Optional[str] = None - MODEL_PROVIDER_API_KEY: Optional[str] = None - - # Service Settings - PORT: int = 5002 - HOST: str = "0.0.0.0" - - # Optional Tool API Keys - OTHER_TOOL_API_KEYS: Optional[str] = None - - class Config: - env_file = ".env" - -settings = Settings() diff --git a/agent-service/src/config/settings.py b/agent-service/src/config/settings.py deleted file mode 100644 index 19bd006..0000000 --- a/agent-service/src/config/settings.py +++ /dev/null @@ -1,21 +0,0 @@ -from pydantic_settings import BaseSettings -from typing import Optional - -class Settings(BaseSettings): - # Model Provider Settings - MODEL_PROVIDER_URL: Optional[str] = None - MODEL_PROVIDER_API_KEY: str - - # Service Settings - PORT: int = 5001 - HOST: str = "0.0.0.0" - LOG_LEVEL: str = "INFO" - - # Optional API Keys - SERPER_API_KEY: Optional[str] = None - BROWSERLESS_API_KEY: Optional[str] = None - - class Config: - env_file = ".env" - -settings = Settings() diff --git a/agent-service/src/main.py b/agent-service/src/main.py deleted file mode 100644 index 49b8d2a..0000000 --- a/agent-service/src/main.py +++ /dev/null @@ -1,68 +0,0 @@ -from fastapi import FastAPI, HTTPException -from .models import TestExecutionRequest, TestExecutionResponse -from .agent_executor import AgentExecutor -from .config import settings -import traceback -import logging - -# Configure logging -logging.basicConfig(level=logging.DEBUG, - format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') -logger = logging.getLogger(__name__) - -app = FastAPI(title="AI Agent Testing Service") -executor = AgentExecutor() - -@app.get("/health") -async def health_check(): - """Health check endpoint.""" - return {"status": "ok"} - -@app.get("/test-connection") -async def test_connection(): - """Test endpoint that doesn't rely on CrewAI.""" - try: - logger.debug("Test connection endpoint called") - return { - "status": "success", - "message": "Connection to agent service is working", - "details": { - "host": settings.HOST, - "port": settings.PORT - } - } - except Exception as e: - error_traceback = traceback.format_exc() - logger.error(f"Error in test connection: {str(e)}") - logger.error(f"Traceback: {error_traceback}") - raise HTTPException(status_code=500, detail=f"Error in test connection: {str(e)}") - -@app.post("/execute-test") -async def execute_test(request: TestExecutionRequest) -> TestExecutionResponse: - """Execute a test with the given configuration.""" - try: - response = executor.execute_test( - agent_configs=request.agent_configs, - crew_config=request.crew_config, - test_input=request.test_input, - test_id=1 # TODO: Handle test ID properly - ) - return response - except Exception as e: - # Get the full traceback - error_traceback = traceback.format_exc() - logger.error(f"Error executing test: {str(e)}") - logger.error(f"Traceback: {error_traceback}") - - # Return more detailed error information - raise HTTPException(status_code=500, - detail=f"Error executing test: {str(e)}. Traceback: {error_traceback}") - -if __name__ == "__main__": - import uvicorn - uvicorn.run( - "main:app", - host=settings.HOST, - port=settings.PORT, - reload=True - ) diff --git a/agent-service/src/models.py b/agent-service/src/models.py deleted file mode 100644 index 0bb9660..0000000 --- a/agent-service/src/models.py +++ /dev/null @@ -1,51 +0,0 @@ -from pydantic import BaseModel -from typing import List, Optional, Dict, Literal -import os - -class ModelConfig(BaseModel): - provider: Literal["ollama"] = "ollama" # For now we only support ollama - model: str # e.g., "llama2", "mistral", "codellama" - temperature: float = 0.7 - max_tokens: int = 1000 - base_url: str = os.environ.get("OLLAMA_BASE_URL", "http://localhost:11434") # Default to original IP, configurable via env - -class AgentConfig(BaseModel): - role: str - goal: str - backstory: str - allow_delegation: bool = False - allow_code_execution: bool = False - memory: bool = False - verbose: bool = True - tools: List[str] = [] - llm_config: ModelConfig - -class CrewConfig(BaseModel): - process: Literal["sequential", "hierarchical"] = "sequential" - async_execution: bool = True - max_retries: int = 3 - -class TestExecutionRequest(BaseModel): - agent_configs: List[AgentConfig] - crew_config: CrewConfig - test_input: str - -class IntermediateStep(BaseModel): - timestamp: str - agent_id: int - action: str - output: str - -class Metrics(BaseModel): - token_usage: int - model_calls: int - tool_calls: int - -class TestExecutionResponse(BaseModel): - agent_id: int - test_id: int - output: str - success: bool - execution_time: float - intermediate_steps: List[IntermediateStep] - metrics: Metrics diff --git a/agent-service/src/models/config.py b/agent-service/src/models/config.py deleted file mode 100644 index 38ff22e..0000000 --- a/agent-service/src/models/config.py +++ /dev/null @@ -1,36 +0,0 @@ -from typing import List, Optional -from pydantic import BaseModel - -class ModelConfig(BaseModel): - provider: str - model: str - temperature: float - max_tokens: int - -class AgentConfig(BaseModel): - role: str - goal: str - backstory: str - allow_delegation: bool = False - allow_code_execution: bool = False - memory: bool = False - verbose: bool = True - tools: List[str] = [] - model_config: ModelConfig - -class CrewConfig(BaseModel): - process: str = "sequential" - async_execution: bool = True - max_retries: int = 3 - -class TestConfig(BaseModel): - name: str - description: Optional[str] = None - input: str - expected_outputs: List[str] - agent_ids: List[int] - crew_config: CrewConfig - -class TestRequest(BaseModel): - test_config: TestConfig - agents: List[AgentConfig] diff --git a/agent-service/src/models/results.py b/agent-service/src/models/results.py deleted file mode 100644 index 55d661a..0000000 --- a/agent-service/src/models/results.py +++ /dev/null @@ -1,23 +0,0 @@ -from typing import List -from pydantic import BaseModel -from datetime import datetime - -class IntermediateStep(BaseModel): - timestamp: datetime - agent_id: int - action: str - output: str - -class Metrics(BaseModel): - token_usage: int - model_calls: int - tool_calls: int - -class TestResult(BaseModel): - agent_id: int - test_id: int - output: str - success: bool - execution_time: float - intermediate_steps: List[IntermediateStep] - metrics: Metrics diff --git a/agent-service/tests/conftest.py b/agent-service/tests/conftest.py deleted file mode 100644 index b9e1808..0000000 --- a/agent-service/tests/conftest.py +++ /dev/null @@ -1,7 +0,0 @@ -import sys -from pathlib import Path - - -PROJECT_ROOT = Path(__file__).resolve().parents[1] -if str(PROJECT_ROOT) not in sys.path: - sys.path.insert(0, str(PROJECT_ROOT)) diff --git a/agent-service/tests/test_config.py b/agent-service/tests/test_config.py deleted file mode 100644 index 3f8e130..0000000 --- a/agent-service/tests/test_config.py +++ /dev/null @@ -1,19 +0,0 @@ -from src.config import Settings - - -def test_default_settings_values(): - settings = Settings() - assert settings.PORT == 5002 - assert settings.HOST == "0.0.0.0" - - -def test_settings_reads_env_values(monkeypatch): - monkeypatch.setenv("PORT", "6010") - monkeypatch.setenv("HOST", "127.0.0.1") - monkeypatch.setenv("MODEL_PROVIDER_URL", "http://localhost:11434") - - settings = Settings() - - assert settings.PORT == 6010 - assert settings.HOST == "127.0.0.1" - assert settings.MODEL_PROVIDER_URL == "http://localhost:11434" diff --git a/docs/README.md b/docs/README.md index 956a82e..3226377 100644 --- a/docs/README.md +++ b/docs/README.md @@ -9,7 +9,7 @@ This folder contains additional documentation for IBM VIBE. - **Architecture**: diagrams and architectural decisions - **Planning**: backlogs and design notes -Note: The Python `agent-service` docs may lag behind current behavior. The actively maintained runtime path is `backend` + `agent-service-api`. +Note: The Python `agent-service` has been removed. The actively maintained runtime path is `backend` + `agent-service-api`. ### Index diff --git a/docs/diagrams/high-level-component-diagram.mermaid b/docs/diagrams/high-level-component-diagram.mermaid index 1300976..9b522b7 100644 --- a/docs/diagrams/high-level-component-diagram.mermaid +++ b/docs/diagrams/high-level-component-diagram.mermaid @@ -2,11 +2,11 @@ graph TB subgraph "AI Agent Testing Suite" Frontend[Frontend
Next.js + React] Backend[Backend
Express.js + TypeScript] - AgentService[Agent Service
FastAPI + CrewAI] + AgentServiceAPI[Agent Service API
Express.js + TypeScript] FutureAgents[Future Agent Services] Frontend -->|HTTP REST API| Backend - Backend -->|HTTP API| AgentService + AgentServiceAPI -->|Polls for jobs| Backend Backend -->|HTTP API| FutureAgents Database[(SQLite Database)] diff --git a/docs/diagrams/sequence-diagram.mermaid b/docs/diagrams/sequence-diagram.mermaid index d3ea56c..f7b5b04 100644 --- a/docs/diagrams/sequence-diagram.mermaid +++ b/docs/diagrams/sequence-diagram.mermaid @@ -6,7 +6,7 @@ sequenceDiagram participant BE as Backend (Express) participant DB as SQLite DB participant ASAPI as Agent-service-api (poller) - participant AS as Agent-service (FastAPI / CrewAI) + participant EXT as External AI API User->>UI: Configure conversation + agent\nClick Execute UI->>BE: Create execution job (conversation_id) @@ -25,8 +25,8 @@ sequenceDiagram BE-->>ASAPI: Job payload + conversation script end - ASAPI->>AS: Execute conversation turn-by-turn - AS-->>ASAPI: Replies + tool calls + metadata + ASAPI->>EXT: Execute conversation turn-by-turn + EXT-->>ASAPI: Replies + tool calls + metadata ASAPI->>BE: Post session + transcript BE->>DB: Persist session + session_messages diff --git a/docs/migration/CONVERSATION_MIGRATION_GUIDE.md b/docs/migration/CONVERSATION_MIGRATION_GUIDE.md index b2e9b5d..72a0078 100644 --- a/docs/migration/CONVERSATION_MIGRATION_GUIDE.md +++ b/docs/migration/CONVERSATION_MIGRATION_GUIDE.md @@ -7,7 +7,7 @@ - `results`: final outputs and scoring (e.g., similarity) - `jobs`: queue entries referencing `test_id` (numeric), status, and result linkage - flow - - frontend starts execution → backend enqueues job → agent-service executes a single request → backend stores `results` + - frontend starts execution → backend enqueues job → agent-service (Python, now removed) executed a single request → backend stored `results` - limitations - single-turn only, no full transcript, limited intermediate visibility @@ -54,8 +54,6 @@ - agent-service-api - poll jobs; dispatch by presence of `conversation_id` vs `test_id` - execute conversations turn-by-turn; post session and transcript -- agent-service (python) - - add conversation execution parity after polish; keep legacy executor for now ### frontend transition diff --git a/docs/quickstart.md b/docs/quickstart.md index 4a68311..5dc2a76 100644 --- a/docs/quickstart.md +++ b/docs/quickstart.md @@ -11,7 +11,6 @@ Required: Optional: -- Python `3.10+` if you are working on the legacy CrewAI service - A local LLM runtime if your chosen agent path depends on one ## 2. Install dependencies @@ -46,7 +45,7 @@ The backend writes SQLite data to `backend/data/agent-testing.db` by default. npm run dev ``` -This starts the backend, agent-service-api, and frontend together. The Python `agent-service` is not part of the default development path. +This starts the backend, agent-service-api, and frontend together. Open [http://localhost:3000](http://localhost:3000). @@ -65,4 +64,3 @@ Open [http://localhost:3000](http://localhost:3000). - If you created local env files before the default backend port changed, update `backend/.env`, `frontend/.env.local`, and `agent-service-api/.env` together. - If jobs stay pending, confirm `agent-service-api/.env` points `BACKEND_URL` at the backend and that `npm run dev` is still running. - If shared package types look stale, run `npm run build:packages` or restart `npm run dev`. -- If you are working on CrewAI, start `agent-service` separately and verify `backend/.env` has the correct `AGENT_SERVICE_URL`. diff --git a/high-level-component-diagram.png b/high-level-component-diagram.png index 96451a9..4d62855 100644 Binary files a/high-level-component-diagram.png and b/high-level-component-diagram.png differ diff --git a/package.json b/package.json index 9b5b743..8bb4ddb 100644 --- a/package.json +++ b/package.json @@ -22,8 +22,7 @@ "typecheck": "npm run typecheck -w backend && npm run typecheck -w frontend && npm run typecheck -w agent-service-api", "test:ts": "npm run test -w backend && npm run test -w frontend && npm run test -w agent-service-api", "test:cli-e2e": "npm run build -w backend && npm run test:e2e -w @ibm-vibe/cli", - "test:agent-service": "cd agent-service && pytest", - "test": "npm run test:ts && npm run test:agent-service", + "test": "npm run test:ts", "dev:backend": "npm run dev -w backend", "dev:agent-service-api": "npm run dev -w agent-service-api", "dev:frontend": "npm run dev -w frontend", diff --git a/sequence-diagram.png b/sequence-diagram.png index 2ed59e9..3f88a3c 100644 Binary files a/sequence-diagram.png and b/sequence-diagram.png differ