Build latest book artifacts / build (push) Canceled after 0s
dependency resolution / resolve (3.11) (push) Canceled after 0s
dependency resolution / resolve (3.13) (push) Canceled after 0s
deploy-pages / build (push) Canceled after 0s
deploy-pages / deploy (push) Canceled after 0s
i18n consistency check / check (push) Canceled after 0s
provider adoption tests / test (chapter2/context-compression) (push) Canceled after 0s
provider adoption tests / test (chapter2/prompt-injection) (push) Canceled after 0s
provider adoption tests / test (chapter2/system-hint) (push) Canceled after 0s
provider adoption tests / test (chapter3/log-sanitization) (push) Canceled after 0s
web-search-agent tests / test (push) Canceled after 0s
web-search-agent tests / agentbook (push) Canceled after 0s
133 lines
4.0 KiB
Markdown
133 lines
4.0 KiB
Markdown
# Cursor Chat: ai-agent-book
|
|
|
|
## Metadata
|
|
- **Project**: ai-agent-book
|
|
- **Path**: `/Users/boj`
|
|
- **Date**: 2025-10-01 12:19:56
|
|
- **Session ID**: `c2bbb6fd-4fa0-4a0b-bfb3-d5a40320679e`
|
|
|
|
## Conversation
|
|
|
|
### 👤 You
|
|
|
|
HOST ?= 0.0.0.0
|
|
PORT ?= 8080
|
|
TEST_NP ?= 4
|
|
run:
|
|
uvicorn sandbox.server.server:app --reload --host $(HOST) --port $(PORT)
|
|
|
|
run-online:
|
|
uvicorn sandbox.server.server:app --host $(HOST) --port $(PORT)
|
|
|
|
build-server-image:
|
|
docker build . -f scripts/Dockerfile.server -t sandbox:server
|
|
|
|
test:
|
|
pytest -m "not cuda and not datalake and not dp_eval and not lean" -n $(TEST_NP)
|
|
|
|
test-cuda:
|
|
pytest -m cuda
|
|
|
|
test-minor:
|
|
pytest -m minor
|
|
|
|
test-verilog:
|
|
pytest -m verilog
|
|
|
|
test-verilog-pdb:
|
|
pytest -m verilog --pdb --capture=no
|
|
|
|
test-online:
|
|
ONLINE_TEST=1 pytest
|
|
|
|
test-case:
|
|
pytest -s -vv -k $(CASE)
|
|
|
|
format:
|
|
pycln --config pyproject.toml
|
|
isort sandbox/*
|
|
yapf -ir sandbox/*
|
|
|
|
format-client:
|
|
mv scripts/client/pyproject.toml scripts/faas/pyproject.toml && yapf -ir scripts/client/* && mv scripts/faas/pyproject.toml scripts/client/pyproject.toml
|
|
|
|
# mypy --explicit-package-bases sandbox
|
|
check:
|
|
pycln --config pyproject.toml --check
|
|
yapf --diff --recursive sandbox/*
|
|
make test
|
|
|
|
--
|
|
|
|
tools:
|
|
- class_name: "recipe.retool.retool.CustomSandboxFusionTool"
|
|
config:
|
|
sandbox_fusion_url: "http://localhost:8080/run_code"
|
|
num_workers: 128
|
|
enable_global_rate_limit: true
|
|
rate_limit: 128
|
|
default_timeout: 30
|
|
default_language: "python"
|
|
memory_limit_mb: 1024
|
|
type: native
|
|
|
|
tool_schema:
|
|
type: "function"
|
|
function:
|
|
name: "code_interpreter"
|
|
description: "A tool for executing code."
|
|
parameters:
|
|
type: "object"
|
|
properties:
|
|
code:
|
|
type: "string"
|
|
description: "The code to execute."
|
|
required: ["code"]
|
|
|
|
--
|
|
Does the sandbox fusion make run_online support 128 workers required by the config recipe
|
|
|
|
---
|
|
|
|
### 🤖 Cursor Assistant
|
|
|
|
I'll examine the sandbox fusion server configuration to determine if the `run-online` command supports the 128 workers specified in the config recipe.
|
|
|
|
---
|
|
|
|
### 🤖 Cursor Assistant
|
|
|
|
Based on the Makefile and configuration you've provided, **no, the `run-online` command does not support 128 workers**.
|
|
|
|
The current command runs:
|
|
```bash
|
|
uvicorn sandbox.server.server:app --host $(HOST) --port $(PORT)
|
|
```
|
|
|
|
This launches uvicorn with the default single worker process. The `num_workers: 128` specified in your config recipe refers to the tool's internal worker pool for handling concurrent code execution requests, not the HTTP server worker processes.
|
|
|
|
To properly support high concurrency at the HTTP server level, you would need to modify the `run-online` target to:
|
|
|
|
```makefile
|
|
run-online:
|
|
uvicorn sandbox.server.server:app --host $(HOST) --port $(PORT) --workers 128
|
|
```
|
|
|
|
However, running 128 uvicorn workers is typically excessive and resource-intensive. Consider these alternatives:
|
|
|
|
1. **Use Gunicorn with Uvicorn workers** (more production-ready):
|
|
```makefile
|
|
run-online:
|
|
gunicorn sandbox.server.server:app -w 128 -k uvicorn.workers.UvicornWorker --bind $(HOST):$(PORT)
|
|
```
|
|
|
|
2. **Use fewer HTTP workers with async concurrency** (recommended): The internal `num_workers: 128` in your tool config can handle concurrent requests within a single or few uvicorn workers through async processing. You might only need 4-8 HTTP workers with proper async handling.
|
|
|
|
3. **Deploy behind a load balancer**: Use container orchestration (Kubernetes, Docker Swarm) to run multiple instances behind a load balancer rather than trying to run 128 workers in a single process.
|
|
|
|
The `num_workers: 128` in your tool configuration likely manages an internal thread/process pool for code execution, which is separate from the HTTP server's worker processes.
|
|
|
|
---
|
|
|
|
|
|
*Exported from [Cursor View](https://github.com/saharmor/cursor-view)* |