Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ python autonomous_agent_demo.py --project-dir my-app --yolo
# Parallel mode: run multiple agents concurrently (1-5 agents)
python autonomous_agent_demo.py --project-dir my-app --parallel --max-concurrency 3

# Batch mode: implement multiple features per agent session (1-3)
# Batch mode: implement multiple features per agent session (1-15)
python autonomous_agent_demo.py --project-dir my-app --batch-size 3

# Batch specific features by ID
Expand Down Expand Up @@ -496,9 +496,9 @@ The orchestrator enforces strict bounds on concurrent processes:

### Multi-Feature Batching

Agents can implement multiple features per session using `--batch-size` (1-3, default: 3):
Agents can implement multiple features per session using `--batch-size` (1-15, default: 3):
- `--batch-size N` - Max features per coding agent batch
- `--testing-batch-size N` - Features per testing batch (1-5, default: 3)
- `--testing-batch-size N` - Features per testing batch (1-15, default: 3)
- `--batch-features 1,2,3` - Specific feature IDs for batch implementation
- `--testing-batch-features 1,2,3` - Specific feature IDs for batch regression testing
- `prompts.py` provides `get_batch_feature_prompt()` for multi-feature prompt generation
Expand Down
4 changes: 2 additions & 2 deletions autonomous_agent_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ def parse_args() -> argparse.Namespace:
"--testing-batch-size",
type=int,
default=3,
help="Number of features per testing batch (1-5, default: 3)",
help="Number of features per testing batch (1-15, default: 3)",
)

parser.add_argument(
"--batch-size",
type=int,
default=3,
help="Max features per coding agent batch (1-3, default: 3)",
help="Max features per coding agent batch (1-15, default: 3)",
)

return parser.parse_args()
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "autoforge-ai",
"version": "0.1.16",
"version": "0.1.17",
"description": "Autonomous coding agent with web UI - build complete apps with AI",
"license": "AGPL-3.0",
"bin": {
Expand Down
8 changes: 4 additions & 4 deletions parallel_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def _dump_database_state(feature_dicts: list[dict], label: str = ""):
MAX_PARALLEL_AGENTS = 5
MAX_TOTAL_AGENTS = 10
DEFAULT_CONCURRENCY = 3
DEFAULT_TESTING_BATCH_SIZE = 3 # Number of features per testing batch (1-5)
DEFAULT_TESTING_BATCH_SIZE = 3 # Number of features per testing batch (1-15)
POLL_INTERVAL = 5 # seconds between checking for ready features
MAX_FEATURE_RETRIES = 3 # Maximum times to retry a failed feature
INITIALIZER_TIMEOUT = 1800 # 30 minutes timeout for initializer
Expand Down Expand Up @@ -168,7 +168,7 @@ def __init__(
yolo_mode: Whether to run in YOLO mode (skip testing agents entirely)
testing_agent_ratio: Number of regression testing agents to maintain (0-3).
0 = disabled, 1-3 = maintain that many testing agents running independently.
testing_batch_size: Number of features to include per testing session (1-5).
testing_batch_size: Number of features to include per testing session (1-15).
Each testing agent receives this many features to regression test.
on_output: Callback for agent output (feature_id, line)
on_status: Callback for agent status changes (feature_id, status)
Expand All @@ -178,8 +178,8 @@ def __init__(
self.model = model
self.yolo_mode = yolo_mode
self.testing_agent_ratio = min(max(testing_agent_ratio, 0), 3) # Clamp 0-3
self.testing_batch_size = min(max(testing_batch_size, 1), 5) # Clamp 1-5
self.batch_size = min(max(batch_size, 1), 3) # Clamp 1-3
self.testing_batch_size = min(max(testing_batch_size, 1), 15) # Clamp 1-15
self.batch_size = min(max(batch_size, 1), 15) # Clamp 1-15
self.on_output = on_output
self.on_status = on_status

Expand Down
15 changes: 11 additions & 4 deletions server/routers/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
from ..utils.validation import validate_project_name


def _get_settings_defaults() -> tuple[bool, str, int, bool, int]:
def _get_settings_defaults() -> tuple[bool, str, int, bool, int, int]:
"""Get defaults from global settings.
Returns:
Tuple of (yolo_mode, model, testing_agent_ratio, playwright_headless, batch_size)
Tuple of (yolo_mode, model, testing_agent_ratio, playwright_headless, batch_size, testing_batch_size)
"""
import sys
root = Path(__file__).parent.parent.parent
Expand All @@ -47,7 +47,12 @@ def _get_settings_defaults() -> tuple[bool, str, int, bool, int]:
except (ValueError, TypeError):
batch_size = 3

return yolo_mode, model, testing_agent_ratio, playwright_headless, batch_size
try:
testing_batch_size = int(settings.get("testing_batch_size", "3"))
except (ValueError, TypeError):
testing_batch_size = 3

return yolo_mode, model, testing_agent_ratio, playwright_headless, batch_size, testing_batch_size


router = APIRouter(prefix="/api/projects/{project_name}/agent", tags=["agent"])
Expand Down Expand Up @@ -96,14 +101,15 @@ async def start_agent(
manager = get_project_manager(project_name)

# Get defaults from global settings if not provided in request
default_yolo, default_model, default_testing_ratio, playwright_headless, default_batch_size = _get_settings_defaults()
default_yolo, default_model, default_testing_ratio, playwright_headless, default_batch_size, default_testing_batch_size = _get_settings_defaults()

yolo_mode = request.yolo_mode if request.yolo_mode is not None else default_yolo
model = request.model if request.model else default_model
max_concurrency = request.max_concurrency or 1
testing_agent_ratio = request.testing_agent_ratio if request.testing_agent_ratio is not None else default_testing_ratio

batch_size = default_batch_size
testing_batch_size = default_testing_batch_size

success, message = await manager.start(
yolo_mode=yolo_mode,
Expand All @@ -112,6 +118,7 @@ async def start_agent(
testing_agent_ratio=testing_agent_ratio,
playwright_headless=playwright_headless,
batch_size=batch_size,
testing_batch_size=testing_batch_size,
)

# Notify scheduler of manual start (to prevent auto-stop during scheduled window)
Expand Down
5 changes: 5 additions & 0 deletions server/routers/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ async def get_settings():
testing_agent_ratio=_parse_int(all_settings.get("testing_agent_ratio"), 1),
playwright_headless=_parse_bool(all_settings.get("playwright_headless"), default=True),
batch_size=_parse_int(all_settings.get("batch_size"), 3),
testing_batch_size=_parse_int(all_settings.get("testing_batch_size"), 3),
api_provider=api_provider,
api_base_url=all_settings.get("api_base_url"),
api_has_auth_token=bool(all_settings.get("api_auth_token")),
Expand All @@ -138,6 +139,9 @@ async def update_settings(update: SettingsUpdate):
if update.batch_size is not None:
set_setting("batch_size", str(update.batch_size))

if update.testing_batch_size is not None:
set_setting("testing_batch_size", str(update.testing_batch_size))

# API provider settings
if update.api_provider is not None:
old_provider = get_setting("api_provider", "claude")
Expand Down Expand Up @@ -177,6 +181,7 @@ async def update_settings(update: SettingsUpdate):
testing_agent_ratio=_parse_int(all_settings.get("testing_agent_ratio"), 1),
playwright_headless=_parse_bool(all_settings.get("playwright_headless"), default=True),
batch_size=_parse_int(all_settings.get("batch_size"), 3),
testing_batch_size=_parse_int(all_settings.get("testing_batch_size"), 3),
api_provider=api_provider,
api_base_url=all_settings.get("api_base_url"),
api_has_auth_token=bool(all_settings.get("api_auth_token")),
Expand Down
17 changes: 13 additions & 4 deletions server/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ class SettingsResponse(BaseModel):
ollama_mode: bool = False # True when api_provider is "ollama"
testing_agent_ratio: int = 1 # Regression testing agents (0-3)
playwright_headless: bool = True
batch_size: int = 3 # Features per coding agent batch (1-3)
batch_size: int = 3 # Features per coding agent batch (1-15)
testing_batch_size: int = 3 # Features per testing agent batch (1-15)
api_provider: str = "claude"
api_base_url: str | None = None
api_has_auth_token: bool = False # Never expose actual token
Expand All @@ -463,7 +464,8 @@ class SettingsUpdate(BaseModel):
model: str | None = None
testing_agent_ratio: int | None = None # 0-3
playwright_headless: bool | None = None
batch_size: int | None = None # Features per agent batch (1-3)
batch_size: int | None = None # Features per agent batch (1-15)
testing_batch_size: int | None = None # Features per testing agent batch (1-15)
api_provider: str | None = None
api_base_url: str | None = Field(None, max_length=500)
api_auth_token: str | None = Field(None, max_length=500) # Write-only, never returned
Expand Down Expand Up @@ -500,8 +502,15 @@ def validate_testing_ratio(cls, v: int | None) -> int | None:
@field_validator('batch_size')
@classmethod
def validate_batch_size(cls, v: int | None) -> int | None:
if v is not None and (v < 1 or v > 3):
raise ValueError("batch_size must be between 1 and 3")
if v is not None and (v < 1 or v > 15):
raise ValueError("batch_size must be between 1 and 15")
return v

@field_validator('testing_batch_size')
@classmethod
def validate_testing_batch_size(cls, v: int | None) -> int | None:
if v is not None and (v < 1 or v > 15):
raise ValueError("testing_batch_size must be between 1 and 15")
return v


Expand Down
4 changes: 4 additions & 0 deletions server/services/process_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ async def start(
testing_agent_ratio: int = 1,
playwright_headless: bool = True,
batch_size: int = 3,
testing_batch_size: int = 3,
) -> tuple[bool, str]:
"""
Start the agent as a subprocess.
Expand Down Expand Up @@ -440,6 +441,9 @@ async def start(
# Add --batch-size flag for multi-feature batching
cmd.extend(["--batch-size", str(batch_size)])

# Add --testing-batch-size flag for testing agent batching
cmd.extend(["--testing-batch-size", str(testing_batch_size)])

# Apply headless setting to .playwright/cli.config.json so playwright-cli
# picks it up (the only mechanism it supports for headless control)
self._apply_playwright_headless(playwright_headless)
Expand Down
2 changes: 1 addition & 1 deletion ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 32 additions & 19 deletions ui/src/components/SettingsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
DialogTitle,
} from '@/components/ui/dialog'
import { Switch } from '@/components/ui/switch'
import { Slider } from '@/components/ui/slider'
import { Label } from '@/components/ui/label'
import { Alert, AlertDescription } from '@/components/ui/alert'
import { Button } from '@/components/ui/button'
Expand Down Expand Up @@ -63,6 +64,12 @@ export function SettingsModal({ isOpen, onClose }: SettingsModalProps) {
}
}

const handleTestingBatchSizeChange = (size: number) => {
if (!updateSettings.isPending) {
updateSettings.mutate({ testing_batch_size: size })
}
}

const handleProviderChange = (providerId: string) => {
if (!updateSettings.isPending) {
updateSettings.mutate({ api_provider: providerId })
Expand Down Expand Up @@ -432,28 +439,34 @@ export function SettingsModal({ isOpen, onClose }: SettingsModalProps) {
</div>
</div>

{/* Features per Agent */}
{/* Features per Coding Agent */}
<div className="space-y-2">
<Label className="font-medium">Features per Agent</Label>
<Label className="font-medium">Features per Coding Agent</Label>
<p className="text-sm text-muted-foreground">
Number of features assigned to each coding agent
Number of features assigned to each coding agent session
</p>
<div className="flex rounded-lg border overflow-hidden">
{[1, 2, 3].map((size) => (
<button
key={size}
onClick={() => handleBatchSizeChange(size)}
disabled={isSaving}
className={`flex-1 py-2 px-3 text-sm font-medium transition-colors ${
(settings.batch_size ?? 1) === size
? 'bg-primary text-primary-foreground'
: 'bg-background text-foreground hover:bg-muted'
} ${isSaving ? 'opacity-50 cursor-not-allowed' : ''}`}
>
{size}
</button>
))}
</div>
<Slider
min={1}
max={15}
value={settings.batch_size ?? 3}
onChange={handleBatchSizeChange}
disabled={isSaving}
/>
</div>

{/* Features per Testing Agent */}
<div className="space-y-2">
<Label className="font-medium">Features per Testing Agent</Label>
<p className="text-sm text-muted-foreground">
Number of features assigned to each testing agent session
</p>
<Slider
min={1}
max={15}
value={settings.testing_batch_size ?? 3}
onChange={handleTestingBatchSizeChange}
disabled={isSaving}
/>
</div>

{/* Update Error */}
Expand Down
44 changes: 44 additions & 0 deletions ui/src/components/ui/slider.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import * as React from "react"
import { cn } from "@/lib/utils"

interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
min: number
max: number
value: number
onChange: (value: number) => void
label?: string
}

function Slider({
className,
min,
max,
value,
onChange,
disabled,
...props
}: SliderProps) {
return (
<div className={cn("flex items-center gap-3", className)}>
<input
type="range"
min={min}
max={max}
value={value}
onChange={(e) => onChange(Number(e.target.value))}
disabled={disabled}
className={cn(
"slider-input h-2 w-full cursor-pointer appearance-none rounded-full bg-input transition-colors",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
disabled && "cursor-not-allowed opacity-50"
)}
{...props}
/>
<span className="min-w-[2ch] text-center text-sm font-semibold tabular-nums">
{value}
</span>
</div>
)
}

export { Slider }
1 change: 1 addition & 0 deletions ui/src/hooks/useProjects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ const DEFAULT_SETTINGS: Settings = {
testing_agent_ratio: 1,
playwright_headless: true,
batch_size: 3,
testing_batch_size: 3,
api_provider: 'claude',
api_base_url: null,
api_has_auth_token: false,
Expand Down
4 changes: 3 additions & 1 deletion ui/src/lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,8 @@ export interface Settings {
ollama_mode: boolean
testing_agent_ratio: number // Regression testing agents (0-3)
playwright_headless: boolean
batch_size: number // Features per coding agent batch (1-3)
batch_size: number // Features per coding agent batch (1-15)
testing_batch_size: number // Features per testing agent batch (1-15)
api_provider: string
api_base_url: string | null
api_has_auth_token: boolean
Expand All @@ -592,6 +593,7 @@ export interface SettingsUpdate {
testing_agent_ratio?: number
playwright_headless?: boolean
batch_size?: number
testing_batch_size?: number
api_provider?: string
api_base_url?: string
api_auth_token?: string
Expand Down
Loading
Loading