File size: 4,133 Bytes
8036886
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# πŸš€ BDR Agent Factory - Quick Start Guide

## Prerequisites

- Python 3.11+
- Docker & Docker Compose (optional)
- PostgreSQL 16+ (if not using Docker)
- Redis 7+ (if not using Docker)

## Installation

### Option 1: Docker (Recommended)

```bash
# Clone the repository
git clone https://huggingface.co/spaces/BDR-AI/BDR-Agent-Factory
cd BDR-Agent-Factory

# Start all services
docker-compose up -d

# Check logs
docker-compose logs -f api
```

The API will be available at http://localhost:8000

### Option 2: Local Development

```bash
# Clone the repository
git clone https://huggingface.co/spaces/BDR-AI/BDR-Agent-Factory
cd BDR-Agent-Factory

# Create virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\\Scripts\\activate

# Install dependencies
pip install -e .[ml,dev]

# Copy environment file
cp .env.example .env
# Edit .env with your configuration

# Start PostgreSQL and Redis (if not using Docker)
# Then run the application
uvicorn bdr_agent_factory.main:app --reload
```

## Quick Test

### 1. Health Check

```bash
curl http://localhost:8000/api/v1/health
```

Expected response:
```json
{
  "status": "healthy",
  "timestamp": "2026-01-03T00:00:00",
  "service": "BDR Agent Factory"
}
```

### 2. List Capabilities

```bash
curl http://localhost:8000/api/v1/capabilities
```

### 3. Get Specific Capability

```bash
curl http://localhost:8000/api/v1/capabilities/cap_text_classification
```

### 4. Search Capabilities

```bash
curl http://localhost:8000/api/v1/capabilities/search/fraud
```

## API Documentation

Once the server is running, visit:

- **Swagger UI**: http://localhost:8000/docs
- **ReDoc**: http://localhost:8000/redoc

## Project Structure

```
BDR-Agent-Factory/
β”œβ”€β”€ src/
β”‚   └── bdr_agent_factory/
β”‚       β”œβ”€β”€ api/              # API endpoints
β”‚       β”œβ”€β”€ capabilities/     # AI capability implementations
β”‚       β”œβ”€β”€ core/            # Core functionality
β”‚       β”œβ”€β”€ models/          # Data models
β”‚       β”œβ”€β”€ services/        # Business logic
β”‚       └── utils/           # Utilities
β”œβ”€β”€ docs/                    # Documentation
β”œβ”€β”€ examples/                # Example implementations
β”œβ”€β”€ tests/                   # Test suite
β”œβ”€β”€ AI_CAPABILITY_DICTIONARY.yaml
β”œβ”€β”€ CAPABILITY_SYSTEM_MAP.yaml
β”œβ”€β”€ pyproject.toml
β”œβ”€β”€ Dockerfile
└── docker-compose.yml
```

## Development Workflow

### Running Tests

```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=bdr_agent_factory --cov-report=html

# Run specific test file
pytest tests/test_registry.py
```

### Code Quality

```bash
# Format code
black src/ tests/

# Lint code
ruff check src/ tests/

# Type checking
mypy src/

# Security scan
bandit -r src/
```

### Database Migrations

```bash
# Create migration
alembic revision --autogenerate -m "description"

# Apply migrations
alembic upgrade head

# Rollback
alembic downgrade -1
```

## Next Steps

1. **Read the Documentation**
   - [API Specification](docs/API_SPECIFICATION.md)
   - [Architecture](docs/ARCHITECTURE.md)
   - [Security Framework](docs/SECURITY_FRAMEWORK.md)

2. **Explore Examples**
   - [Text Classification](examples/text_classification_example.py)
   - [Fraud Detection](examples/fraud_detection_example.py)
   - [Integration Example](examples/integration_example.py)

3. **Deploy to Production**
   - Review [Deployment Guide](docs/VERSION_CONTROL_STRATEGY.md)
   - Configure monitoring and logging
   - Set up CI/CD pipeline

## Troubleshooting

### Port Already in Use

```bash
# Change port in docker-compose.yml or .env
API_PORT=8001
```

### Database Connection Error

```bash
# Check PostgreSQL is running
docker-compose ps

# Check database logs
docker-compose logs db
```

### Redis Connection Error

```bash
# Check Redis is running
docker-compose ps

# Test Redis connection
redis-cli ping
```

## Support

- **Documentation**: See `/docs` directory
- **Issues**: Open an issue on HuggingFace
- **Discussions**: Join the discussion board

## License

MIT License - See [LICENSE](LICENSE) for details