diff options
| author | Ben Sima <ben@bensima.com> | 2026-06-04 16:38:54 -0400 |
|---|---|---|
| committer | Ben Sima <ben@bensima.com> | 2026-06-04 16:38:54 -0400 |
| commit | fe04ad47c9abf843cb6f64176981325a5b05f074 (patch) | |
| tree | 212dc37a6ed0a16eebc72f3ab06b35949b09b71b /main.py | |
| parent | 11fd65b015dc6e24127f3cfdcb08975704381d46 (diff) | |
Add tests and fix research tools
Diffstat (limited to 'main.py')
| -rw-r--r-- | main.py | 25 |
1 files changed, 17 insertions, 8 deletions
@@ -41,6 +41,7 @@ AGENT_TIMEOUT = int(os.environ.get("SLOPBOT_AGENT_TIMEOUT", "120")) AGENT_MODEL = os.environ.get("SLOPBOT_AGENT_MODEL", "parasail/kimi-k26") AGENT_BIN = os.environ.get("SLOPBOT_AGENT", "agent") AGENT_PATH = os.environ.get("SLOPBOT_AGENT_PATH", os.environ.get("PATH", "")) +AGENT_DEBUG = os.environ.get("SLOPBOT_AGENT_DEBUG", "").lower() in {"1", "true", "yes", "on"} WORKERS = int(os.environ.get("SLOPBOT_WORKERS", "4")) AGENT_WORKERS = int(os.environ.get("SLOPBOT_AGENT_WORKERS", "1")) HISTORY_LIMIT = int(os.environ.get("SLOPBOT_HISTORY_LIMIT", "20")) @@ -126,16 +127,24 @@ def _agent(prompt: str) -> tuple[int, str, str]: """Run agent once; return (returncode, stdout, stderr).""" env = os.environ.copy() env["PATH"] = AGENT_PATH + command = [ + AGENT_BIN, + "--model", AGENT_MODEL, + "--eval-cwd", str(BASE_DIR), + ] + if AGENT_DEBUG: + command.append("--debug") + command.append(prompt) + result = subprocess.run( - [ - AGENT_BIN, - "--model", AGENT_MODEL, - "--eval-cwd", str(BASE_DIR), - prompt, - ], - capture_output=True, text=True, timeout=AGENT_TIMEOUT, env=env, + command, + stdout=subprocess.PIPE, + stderr=None if AGENT_DEBUG else subprocess.PIPE, + text=True, + timeout=AGENT_TIMEOUT, + env=env, ) - return result.returncode, result.stdout.strip(), result.stderr.strip() + return result.returncode, result.stdout.strip(), (result.stderr or "").strip() def _unique_session_name(msg: dict) -> str: |
