Skip to content

Commit 888d65b

Browse files
committed
Restructure AgenticCodeExecution: examples/ per-domain layout
Sync with standalone Agentic-Code-Execution repo refactor: - Replace tools-server/, system-prompts/, data/ with examples/{domain}/ structure - Each domain (retail, airline, stocks, banking, triage) is self-contained - Remove start_all.sh (unused) - Update docker-compose.yml, Dockerfile, .gitignore, README paths - Update MCP server imports and default DB/session paths Signed-off-by: Rafal Bogdanowicz <rafal.bogdanowicz@intel.com>
1 parent 3854652 commit 888d65b

26 files changed

Lines changed: 51 additions & 76 deletions

sample_solutions/AgenticCodeExecution/.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ prompt-builder/data/retail/sections/section2_seed.txt
1717
prompt-builder/data/retail/sections/section3_policy.txt
1818

1919
# tau2-bench database files (downloaded separately, see README)
20-
data/airline/db.json
21-
data/retail/db.json
20+
examples/airline/data/db.json
21+
examples/retail/data/db.json
2222

2323
# Runtime session data
24-
tools-server/session_dbs/
24+
examples/session_dbs/

sample_solutions/AgenticCodeExecution/README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Agentic Code Execution — MCP Agent Servers
22

33
Two-server MCP architecture for code-execution agents:
4-
- **tools-server** — domain APIs (retail, airline, stocks, banking, triage)
4+
- **tools-server** — domain APIs (retail, airline, stocks, banking, triage) in `examples/`
55
- **sandbox-server**`execute_python` with `actions.*` proxy
66

77
Designed for Flowise / custom MCP clients.
@@ -17,7 +17,7 @@ Flowise (or other MCP client)
1717
└── retail | airline | stocks | banking | triage
1818
```
1919

20-
**tools-server (port 5050)** — Runs one domain at a time. Retail, airline, stocks, and banking domains use per-session DB copies (under `tools-server/session_dbs/`). Internal error hint logic in `tools-server/error_hints.py`.
20+
**tools-server (port 5050)** — Runs one domain at a time. Retail, airline, stocks, and banking domains use per-session DB copies (under `examples/session_dbs/`). Internal error hint logic in `examples/error_hints.py`.
2121

2222
**sandbox-server (port 5051)** — Exposes `execute_python` and proxies `actions.*` calls to tools-server. Uses session-aware routing (`mcp-session-id`) and stores run hashes in `sandbox-server/session_hashes/`. Starts independently and auto-refreshes tool discovery in the background. Dynamically regenerates `execute_python` description when connected tools change.
2323

@@ -42,10 +42,10 @@ You can also set `MCP_DOMAIN` in `.env`.
4242
Before first run, download the τ-bench databases for **airline** and **retail** (or let the servers auto-download on first startup):
4343

4444
```bash
45-
curl -L -o ./data/airline/db.json \
45+
curl -L -o ./examples/airline/data/db.json \
4646
https://raw.githubusercontent.com/sierra-research/tau2-bench/main/data/tau2/domains/airline/db.json
4747

48-
curl -L -o ./data/retail/db.json \
48+
curl -L -o ./examples/retail/data/db.json \
4949
https://raw.githubusercontent.com/sierra-research/tau2-bench/main/data/tau2/domains/retail/db.json
5050
```
5151

@@ -55,8 +55,8 @@ The **banking** and **stocks** databases are included in the repository. The **t
5555

5656
### Docker notes
5757

58-
- Compose mounts `./data` into the tools container at `/data`.
59-
- Default DB paths: `/data/<domain>/db.json`. Override with `RETAIL_DB_PATH`, `AIRLINE_DB_PATH`, `STOCKS_DB_PATH`, `BANKING_DB_PATH`.
58+
- Compose builds the tools-server image from `examples/Dockerfile`.
59+
- Default DB paths are resolved relative to each domain's directory (e.g. `examples/retail/data/db.json`). Override with `RETAIL_DB_PATH`, `AIRLINE_DB_PATH`, `STOCKS_DB_PATH`, `BANKING_DB_PATH`.
6060
- `NO_PROXY`/`no_proxy` is set for internal service-to-service calls.
6161
- If `docker compose build` fails behind a proxy, see [Troubleshooting](#docker-build-fails-behind-proxy).
6262

@@ -306,16 +306,16 @@ For local development, install dependencies and run servers manually.
306306
```bash
307307
python -m venv venv && source venv/bin/activate
308308
pip install -r requirements.txt
309-
pip install -r tools-server/requirements.txt
309+
pip install -r examples/requirements.txt
310310
pip install -r sandbox-server/requirements.txt
311311
```
312312

313313
Run any domain (two terminals):
314314

315315
```bash
316316
# Terminal 1 — tools server (pick one domain)
317-
cd tools-server
318-
python mcp_retail_server.py --port 5050 # or mcp_airline_server.py, etc.
317+
cd examples/retail
318+
python mcp_retail_server.py --port 5050 # or cd ../airline && python mcp_airline_server.py, etc.
319319

320320
# Terminal 2 — sandbox server (same for all domains)
321321
cd sandbox-server

sample_solutions/AgenticCodeExecution/docker-compose.yml

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,16 @@ services:
22
tools-server:
33
build:
44
context: .
5-
dockerfile: tools-server/Dockerfile
5+
dockerfile: examples/Dockerfile
66
container_name: mcp-tools-server
77
ports:
88
- "5050:5050"
99
environment:
1010
MCP_DOMAIN: ${MCP_DOMAIN:-retail}
11-
RETAIL_DB_PATH: ${RETAIL_DB_PATH:-/data/retail/db.json}
12-
AIRLINE_DB_PATH: ${AIRLINE_DB_PATH:-/data/airline/db.json}
13-
STOCKS_DB_PATH: ${STOCKS_DB_PATH:-/data/stocks/db.json}
14-
BANKING_DB_PATH: ${BANKING_DB_PATH:-/data/banking/db.json}
15-
TRIAGE_DB_PATH: ${TRIAGE_DB_PATH:-}
1611
NO_PROXY: tools-server,mcp-tools-server,localhost,127.0.0.1
1712
no_proxy: tools-server,mcp-tools-server,localhost,127.0.0.1
1813
volumes:
19-
- tools-sessions:/app/tools-server/session_dbs
20-
- ./data:/data
14+
- tools-sessions:/app/examples/session_dbs
2115
healthcheck:
2216
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:5050/sse', timeout=3)"]
2317
interval: 5s
@@ -26,15 +20,15 @@ services:
2620
start_period: 5s
2721
command: >
2822
sh -c 'if [ "$${MCP_DOMAIN}" = "airline" ]; then
29-
python mcp_airline_server.py --host 0.0.0.0 --port 5050 --db-path "$${AIRLINE_DB_PATH}";
23+
cd airline && python mcp_airline_server.py --host 0.0.0.0 --port 5050;
3024
elif [ "$${MCP_DOMAIN}" = "stocks" ]; then
31-
python mcp_stocks_server.py --host 0.0.0.0 --port 5050 --db-path "$${STOCKS_DB_PATH}";
25+
cd stocks && python mcp_stocks_server.py --host 0.0.0.0 --port 5050;
3226
elif [ "$${MCP_DOMAIN}" = "banking" ]; then
33-
python mcp_banking_server.py --host 0.0.0.0 --port 5050 --db-path "$${BANKING_DB_PATH}";
27+
cd banking && python mcp_banking_server.py --host 0.0.0.0 --port 5050;
3428
elif [ "$${MCP_DOMAIN}" = "triage" ]; then
35-
python mcp_triage_server.py --host 0.0.0.0 --port 5050;
29+
cd triage && python mcp_triage_server.py --host 0.0.0.0 --port 5050;
3630
else
37-
python mcp_retail_server.py --host 0.0.0.0 --port 5050 --db-path "$${RETAIL_DB_PATH}";
31+
cd retail && python mcp_retail_server.py --host 0.0.0.0 --port 5050;
3832
fi'
3933
restart: unless-stopped
4034

sample_solutions/AgenticCodeExecution/tools-server/Dockerfile renamed to sample_solutions/AgenticCodeExecution/examples/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
77
WORKDIR /app
88

99
COPY requirements.txt /app/requirements.txt
10-
COPY tools-server/requirements.txt /app/tools-server-requirements.txt
10+
COPY examples/requirements.txt /app/examples-requirements.txt
1111
RUN pip install --no-cache-dir -r /app/requirements.txt \
12-
&& pip install --no-cache-dir -r /app/tools-server-requirements.txt
12+
&& pip install --no-cache-dir -r /app/examples-requirements.txt
1313

14-
COPY tools-server /app/tools-server
15-
WORKDIR /app/tools-server
14+
COPY examples /app/examples
15+
WORKDIR /app/examples
1616

1717
EXPOSE 5050
1818

19-
CMD ["python", "mcp_retail_server.py", "--host", "0.0.0.0", "--port", "5050"]
19+
CMD ["python", "retail/mcp_retail_server.py", "--host", "0.0.0.0", "--port", "5050"]

sample_solutions/AgenticCodeExecution/system-prompts/airline-system-prompt.txt renamed to sample_solutions/AgenticCodeExecution/examples/airline/airline-system-prompt.txt

File renamed without changes.

sample_solutions/AgenticCodeExecution/tools-server/airline_data_model.py renamed to sample_solutions/AgenticCodeExecution/examples/airline/airline_data_model.py

File renamed without changes.

sample_solutions/AgenticCodeExecution/data/airline/.gitkeep renamed to sample_solutions/AgenticCodeExecution/examples/airline/data/.gitkeep

File renamed without changes.

sample_solutions/AgenticCodeExecution/tools-server/mcp_airline_server.py renamed to sample_solutions/AgenticCodeExecution/examples/airline/mcp_airline_server.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
from typing import Any, Dict, List, Optional
1616

1717
from fastmcp import FastMCP
18+
19+
# Add parent directory to sys.path for shared modules (error_hints)
20+
sys.path.insert(0, str(Path(__file__).resolve().parent.parent))
21+
1822
from airline_data_model import (
1923
AirportCode,
2024
CabinClass,
@@ -33,7 +37,7 @@
3337
from error_hints import analyze_execution_error
3438

3539

36-
DEFAULT_DB_PATH = str(Path(__file__).resolve().parent.parent / "data" / "airline" / "db.json")
40+
DEFAULT_DB_PATH = str(Path(__file__).resolve().parent / "data" / "db.json")
3741

3842
TAU2_BENCH_URL = (
3943
"https://raw.githubusercontent.com/sierra-research/tau2-bench/"
@@ -76,7 +80,7 @@ def ensure_db(db_path: str) -> None:
7680
_db: Optional[FlightDB] = None # Read-only template DB
7781
_original_db_path: str = "" # Path to original pristine DB file
7882
_session_dbs: Dict[str, FlightDB] = {} # Per-session DB copies
79-
SESSION_DB_DIR = Path(__file__).parent / "session_dbs"
83+
SESSION_DB_DIR = Path(__file__).resolve().parent.parent / "session_dbs"
8084
SESSION_DB_DIR.mkdir(exist_ok=True)
8185

8286

sample_solutions/AgenticCodeExecution/system-prompts/banking-system-prompt.txt renamed to sample_solutions/AgenticCodeExecution/examples/banking/banking-system-prompt.txt

File renamed without changes.

sample_solutions/AgenticCodeExecution/tools-server/banking_data_model.py renamed to sample_solutions/AgenticCodeExecution/examples/banking/banking_data_model.py

File renamed without changes.

0 commit comments

Comments
 (0)