Skip to content

Commit d4a0e91

Browse files
committed
all agents updated
1 parent 1e78170 commit d4a0e91

14 files changed

Lines changed: 193 additions & 62 deletions

File tree

agents/crewai/websearch_agent/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ COPY src/ ./src/
1919
# Install the project and its dependencies using uv
2020
RUN uv pip install --system --no-cache .
2121

22-
# Copy the application entrypoint
22+
# Copy the application entrypoint, playground UI, and images
2323
COPY main.py .
24+
COPY playground/ ./playground/
25+
COPY images/ ./images/
2426

2527
# Pre-create the directory that CrewAI writes to at import time
2628
# (crewai.utilities.paths.db_storage_path -> ~/.local/share/app/)

agents/crewai/websearch_agent/README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,29 @@ curl -sN -X POST https://<YOUR_ROUTE_URL>/chat/completions \
203203

204204
## Playground UI
205205

206-
A browser-based chat interface for interacting with the agent. Built with Flask, it provides a simple chat window with streaming responses — no curl needed.
206+
A browser-based chat interface is served directly by the agent at the root URL — no separate process needed.
207207

208-
### Prerequisites
208+
### Running the Playground
209209

210-
Make sure the agent is running first (see sections above), then install the playground dependency:
210+
Start the agent and open the root URL in your browser:
211211

212212
```bash
213-
uv pip install flask
213+
uvicorn main:app --port 8000
214214
```
215215

216-
### Running the Playground
216+
Open [http://localhost:8000](http://localhost:8000) in your browser.
217+
218+
A green dot in the header means the agent is connected and ready. Type a message and press **Enter** to send.
219+
220+
When deployed to OpenShift, the playground is available at the route URL.
221+
222+
### Standalone Flask Playground (alternative)
223+
224+
You can also run the playground as a separate Flask app if needed:
225+
226+
```bash
227+
uv pip install flask
228+
```
217229

218230
```bash
219231
# Terminal 1: Start the agent
@@ -223,12 +235,6 @@ uvicorn main:app --port 8000
223235
flask --app playground/app run --port 5001
224236
```
225237

226-
Open [http://localhost:5001](http://localhost:5001) in your browser.
227-
228-
A green dot in the header means the agent is connected and ready. Type a message and press **Enter** to send.
229-
230-
### Configuration
231-
232238
| Variable | Default | Description |
233239
|-------------|--------------------------|---------------------------------|
234240
| `AGENT_URL` | `http://localhost:8000` | URL of the running agent API |

agents/crewai/websearch_agent/deploy.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ set -e # Exit on error
1616
source .env
1717
export CONTAINER_IMAGE BASE_URL MODEL_ID
1818

19+
## ============================================
20+
# COPY SHARED IMAGES FOR DOCKER BUILD CONTEXT
21+
## ============================================
22+
23+
cp -r ../../../images ./images && echo "Images copied into build context"
24+
trap 'rm -rf ./images' EXIT
25+
1926
## ============================================
2027
# DOCKER BUILD
2128
## ============================================

agents/crewai/websearch_agent/main.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
import uuid
77
from contextlib import asynccontextmanager
88
from os import getenv
9+
from pathlib import Path
910

1011
from crewai import LLM
1112
from fastapi import FastAPI, HTTPException
12-
from fastapi.responses import StreamingResponse
13+
from fastapi.responses import FileResponse, HTMLResponse, StreamingResponse
1314
from pydantic import BaseModel, Field
1415

1516
from crewai_web_search.crew import AssistanceAgents
@@ -364,6 +365,30 @@ async def health():
364365
return {"status": "healthy", "agent_initialized": llm is not None}
365366

366367

368+
# ── Playground UI ────────────────────────────────────────────────────────────
369+
_BASE_DIR = Path(__file__).resolve().parent
370+
_PLAYGROUND_HTML = _BASE_DIR / "playground" / "templates" / "index.html"
371+
# In Docker the images are copied to /app/images; locally they live at the repo root
372+
_IMAGES_DIR = _BASE_DIR / "images"
373+
if not _IMAGES_DIR.is_dir():
374+
_IMAGES_DIR = _BASE_DIR.parent.parent.parent / "images"
375+
376+
377+
@app.get("/", response_class=HTMLResponse, include_in_schema=False)
378+
async def playground():
379+
"""Serve the playground chat UI."""
380+
return FileResponse(_PLAYGROUND_HTML)
381+
382+
383+
@app.get("/images/{filename:path}", include_in_schema=False)
384+
async def serve_image(filename: str):
385+
"""Serve images from the project-level images directory."""
386+
file_path = _IMAGES_DIR / filename
387+
if not file_path.is_file():
388+
raise HTTPException(status_code=404, detail="Image not found")
389+
return FileResponse(file_path)
390+
391+
367392
if __name__ == "__main__":
368393
import uvicorn
369394

agents/langgraph/agentic_rag/README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,17 +256,29 @@ curl -X POST https://<YOUR_ROUTE_URL>/stream \
256256

257257
## Playground UI
258258

259-
A browser-based chat interface for interacting with the agent. Built with Flask, it provides a simple chat window with streaming responses — no curl needed.
259+
A browser-based chat interface is served directly by the agent at the root URL — no separate process needed.
260260

261-
### Prerequisites
261+
### Running the Playground
262262

263-
Make sure the agent is running first (see sections above), then install the playground dependency:
263+
Start the agent and open the root URL in your browser:
264264

265265
```bash
266-
uv pip install flask
266+
uvicorn main:app --port 8000
267267
```
268268

269-
### Running the Playground
269+
Open [http://localhost:8000](http://localhost:8000) in your browser.
270+
271+
A green dot in the header means the agent is connected and ready. Type a message and press **Enter** to send.
272+
273+
When deployed to OpenShift, the playground is available at the route URL.
274+
275+
### Standalone Flask Playground (alternative)
276+
277+
You can also run the playground as a separate Flask app if needed:
278+
279+
```bash
280+
uv pip install flask
281+
```
270282

271283
```bash
272284
# Terminal 1: Start the agent
@@ -276,12 +288,6 @@ uvicorn main:app --port 8000
276288
flask --app playground/app run --port 5001
277289
```
278290

279-
Open [http://localhost:5001](http://localhost:5001) in your browser.
280-
281-
A green dot in the header means the agent is connected and ready. Type a message and press **Enter** to send.
282-
283-
### Configuration
284-
285291
| Variable | Default | Description |
286292
|-------------|--------------------------|---------------------------------|
287293
| `AGENT_URL` | `http://localhost:8000` | URL of the running agent API |

agents/langgraph/react_agent/README.md

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -213,18 +213,29 @@ curl -X POST https://<YOUR_ROUTE_URL>/chat/completions \
213213

214214
## Playground UI
215215

216-
A browser-based chat interface for interacting with the agent. Built with Flask, it provides a simple chat window with
217-
streaming responses — no curl needed.
216+
A browser-based chat interface is served directly by the agent at the root URL — no separate process needed.
218217

219-
### Prerequisites
218+
### Running the Playground
220219

221-
Make sure the agent is running first (see sections above), then install the playground dependency:
220+
Start the agent and open the root URL in your browser:
222221

223222
```bash
224-
uv pip install flask
223+
uvicorn main:app --port 8000
225224
```
226225

227-
### Running the Playground
226+
Open [http://localhost:8000](http://localhost:8000) in your browser.
227+
228+
A green dot in the header means the agent is connected and ready. Type a message and press **Enter** to send.
229+
230+
When deployed to OpenShift, the playground is available at the route URL.
231+
232+
### Standalone Flask Playground (alternative)
233+
234+
You can also run the playground as a separate Flask app if needed:
235+
236+
```bash
237+
uv pip install flask
238+
```
228239

229240
```bash
230241
# Terminal 1: Start the agent
@@ -234,12 +245,6 @@ uvicorn main:app --port 8000
234245
flask --app playground/app run --port 5001
235246
```
236247

237-
Open [http://localhost:5001](http://localhost:5001) in your browser.
238-
239-
A green dot in the header means the agent is connected and ready. Type a message and press **Enter** to send.
240-
241-
### Configuration
242-
243248
| Variable | Default | Description |
244249
|-------------|-------------------------|------------------------------|
245250
| `AGENT_URL` | `http://localhost:8000` | URL of the running agent API |

agents/llamaindex/websearch_agent/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ COPY src/ ./src/
1919
# Install the project and its dependencies using uv
2020
RUN uv pip install --system --no-cache .
2121

22-
# Copy the application entrypoint
22+
# Copy the application entrypoint, playground UI, and images
2323
COPY main.py .
24+
COPY playground/ ./playground/
25+
COPY images/ ./images/
2426

2527
# Change ownership of the app directory to the non-privileged user
2628
RUN chown -R appuser:appuser /app

agents/llamaindex/websearch_agent/README.md

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -212,17 +212,29 @@ curl -X POST https://<YOUR_ROUTE_URL>/chat/completions \
212212

213213
## Playground UI
214214

215-
A browser-based chat interface for interacting with the agent. Built with Flask, it provides a simple chat window with streaming responses — no curl needed.
215+
A browser-based chat interface is served directly by the agent at the root URL — no separate process needed.
216216

217-
### Prerequisites
217+
### Running the Playground
218218

219-
Make sure the agent is running first (see sections above), then install the playground dependency:
219+
Start the agent and open the root URL in your browser:
220220

221221
```bash
222-
uv pip install flask
222+
uvicorn main:app --port 8000
223223
```
224224

225-
### Running the Playground
225+
Open [http://localhost:8000](http://localhost:8000) in your browser.
226+
227+
A green dot in the header means the agent is connected and ready. Type a message and press **Enter** to send.
228+
229+
When deployed to OpenShift, the playground is available at the route URL.
230+
231+
### Standalone Flask Playground (alternative)
232+
233+
You can also run the playground as a separate Flask app if needed:
234+
235+
```bash
236+
uv pip install flask
237+
```
226238

227239
```bash
228240
# Terminal 1: Start the agent
@@ -232,12 +244,6 @@ uvicorn main:app --port 8000
232244
flask --app playground/app run --port 5001
233245
```
234246

235-
Open [http://localhost:5001](http://localhost:5001) in your browser.
236-
237-
A green dot in the header means the agent is connected and ready. Type a message and press **Enter** to send.
238-
239-
### Configuration
240-
241247
| Variable | Default | Description |
242248
|-------------|--------------------------|---------------------------------|
243249
| `AGENT_URL` | `http://localhost:8000` | URL of the running agent API |

agents/llamaindex/websearch_agent/deploy.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ set -e # Exit on error
1616
source .env
1717
export CONTAINER_IMAGE BASE_URL MODEL_ID
1818

19+
## ============================================
20+
# COPY SHARED IMAGES FOR DOCKER BUILD CONTEXT
21+
## ============================================
22+
23+
cp -r ../../../images ./images && echo "Images copied into build context"
24+
trap 'rm -rf ./images' EXIT
25+
1926
## ============================================
2027
# DOCKER BUILD
2128
## ============================================

agents/llamaindex/websearch_agent/main.py

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
import uuid
55
from contextlib import asynccontextmanager
66
from os import getenv
7+
from pathlib import Path
78

89
from fastapi import FastAPI, HTTPException
9-
from fastapi.responses import StreamingResponse
10+
from fastapi.responses import FileResponse, HTMLResponse, StreamingResponse
1011
from websearch_agent.agent import get_workflow_closure
1112
from websearch_agent.workflow import ToolCallEvent, InputEvent
1213
from pydantic import BaseModel, Field
@@ -450,6 +451,30 @@ async def health():
450451
return {"status": "healthy", "agent_initialized": get_agent is not None}
451452

452453

454+
# ── Playground UI ────────────────────────────────────────────────────────────
455+
_BASE_DIR = Path(__file__).resolve().parent
456+
_PLAYGROUND_HTML = _BASE_DIR / "playground" / "templates" / "index.html"
457+
# In Docker the images are copied to /app/images; locally they live at the repo root
458+
_IMAGES_DIR = _BASE_DIR / "images"
459+
if not _IMAGES_DIR.is_dir():
460+
_IMAGES_DIR = _BASE_DIR.parent.parent.parent / "images"
461+
462+
463+
@app.get("/", response_class=HTMLResponse, include_in_schema=False)
464+
async def playground():
465+
"""Serve the playground chat UI."""
466+
return FileResponse(_PLAYGROUND_HTML)
467+
468+
469+
@app.get("/images/{filename:path}", include_in_schema=False)
470+
async def serve_image(filename: str):
471+
"""Serve images from the project-level images directory."""
472+
file_path = _IMAGES_DIR / filename
473+
if not file_path.is_file():
474+
raise HTTPException(status_code=404, detail="Image not found")
475+
return FileResponse(file_path)
476+
477+
453478
if __name__ == "__main__":
454479
import uvicorn
455480

0 commit comments

Comments
 (0)