Skip to content

Commit dcefbfd

Browse files
committed
github page addition
1 parent ad397f3 commit dcefbfd

10 files changed

Lines changed: 155 additions & 141 deletions

File tree

.env

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
OPENSEARCH_OAUTH_TOKEN=ZTViYjE2ZTMtNGE0OS00YzJhLThiMTItYWY4YTA2NDIyOTJmNmNkNjE5N2UtZmEz_PF84_6078fba4-49d9-4291-9f7b-80116aab6974
2+
OPENSEARCH_OAUTH_NAME=MicroserviceLogAnalyzer
3+
OPENSEARCH_OAUTH_PASSWORD=QBLP.qsxh.16.VIKL.cdwz.38.CZKP.rtwm.3467
4+
OPENSEARCH_OAUTH_CLIENT_ID=C652d21a85854402b5bd7b2207ef96575e47bbb5c168008eeaba51ec7d8e37e93
5+
OPENSEARCH_OAUTH_CLIENT_SECRET=84ec522d2e99bdf8ac2386c44210f1e921f7cab0f65db734f27798ea43545788
6+
OPENSEARCH_OAUTH_SCOPE=lma-logging:serviceowners_read lma-logging:wxcalling_read
7+
OPENSEARCH_OAUTH_BEARER_TOKEN_URL=https://idbroker.webex.com/idb/token/6078fba4-49d9-4291-9f7b-80116aab6974/v2/actions/GetBearerToken/invoke
8+
OPENSEARCH_OAUTH_TOKEN_URL=https://idbroker.webex.com/idb/oauth2/v1/access_token
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Deploy Frontend to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
paths:
7+
- "log-analyzer-frontend/**"
8+
- ".github/workflows/deploy-frontend.yml"
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: true
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: "20"
29+
cache: "pnpm"
30+
cache-dependency-path: "log-analyzer-frontend/pnpm-lock.yaml"
31+
32+
- uses: pnpm/action-setup@v4
33+
with:
34+
version: "10.12.4"
35+
36+
- name: Install dependencies
37+
working-directory: log-analyzer-frontend
38+
run: pnpm install --frozen-lockfile
39+
40+
- name: Build static site
41+
working-directory: log-analyzer-frontend
42+
env:
43+
NEXT_PUBLIC_EXPORT: "true"
44+
NEXT_PUBLIC_BASE_PATH: "/${{ github.event.repository.name }}"
45+
NEXT_PUBLIC_ADK_API_URL: "${{ vars.NEXT_PUBLIC_ADK_API_URL }}"
46+
run: pnpm run build
47+
48+
- name: Upload Pages artifact
49+
uses: actions/upload-pages-artifact@v3
50+
with:
51+
path: log-analyzer-frontend/out
52+
53+
deploy:
54+
needs: build
55+
runs-on: ubuntu-latest
56+
environment:
57+
name: github-pages
58+
url: ${{ steps.deployment.outputs.page_url }}
59+
steps:
60+
- id: deployment
61+
uses: actions/deploy-pages@v4

README.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,19 @@ MCPToolset(
5454

5555
- Make sure required environment variables for OpenSearch/MCP are set properly.
5656

57+
Create a `.env` file at the repo root with:
58+
59+
```bash
60+
OPENSEARCH_OAUTH_TOKEN=
61+
OPENSEARCH_OAUTH_NAME=
62+
OPENSEARCH_OAUTH_PASSWORD=
63+
OPENSEARCH_OAUTH_CLIENT_ID=
64+
OPENSEARCH_OAUTH_CLIENT_SECRET=
65+
OPENSEARCH_OAUTH_SCOPE=
66+
OPENSEARCH_OAUTH_BEARER_TOKEN_URL=
67+
OPENSEARCH_OAUTH_TOKEN_URL=
68+
```
69+
5770
---
5871

5972
### 4. Set Up the Frontend UI
@@ -66,6 +79,12 @@ pnpm run dev
6679

6780
The UI will be available at [http://localhost:3000](http://localhost:3000).
6881

82+
Set the backend URL for the UI:
83+
84+
```bash
85+
export NEXT_PUBLIC_ADK_API_URL="http://127.0.0.1:8000"
86+
```
87+
6988
---
7089

7190
### 5. Configure LLM Usage
@@ -110,5 +129,21 @@ This will launch the backend agent system using the Agent Development Kit (ADK).
110129

111130
---
112131

132+
## 🌍 Host the Frontend on GitHub Pages
133+
134+
This project includes a GitHub Actions workflow that builds a static Next.js
135+
export and publishes it to GitHub Pages.
136+
137+
1. Set a repo variable named `NEXT_PUBLIC_ADK_API_URL` to your ngrok URL
138+
(example: `https://<your-subdomain>.ngrok.app`).
139+
2. Push to `main` or run the workflow manually.
140+
3. In GitHub Pages settings, choose **Source: GitHub Actions**.
141+
142+
Notes:
143+
- The workflow sets `NEXT_PUBLIC_BASE_PATH` to `/<repo-name>` automatically.
144+
- Ensure your backend allows CORS from the GitHub Pages domain.
145+
146+
---
147+
113148
## 📬 Contributing
114149
Found a bug or want to improve this project? Open a pull request or issue.

agents/search_agent/agent.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import shutil
23
from google.adk.agents import LlmAgent, SequentialAgent
34
from google.adk.models.lite_llm import LiteLlm
45
from google.adk.tools.mcp_tool.mcp_toolset import (
@@ -7,6 +8,8 @@
78
StdioConnectionParams,
89
)
910

11+
UV_PATH = "/opt/homebrew/bin/uv"
12+
1013
# Agent 1: Search Mobius logs in wxm-app indexes
1114
wxm_search_agent = LlmAgent(
1215
model=LiteLlm(
@@ -120,10 +123,10 @@
120123
connection_params=StdioConnectionParams(
121124
timeout=1000.0,
122125
server_params=StdioServerParameters(
123-
command="/Users/sarangsa/.local/bin/uv",
126+
command=UV_PATH,
124127
args=[
125128
"--directory",
126-
"/Users/sarangsa/Code/microservice-log-analyzer/opensearch-mcp-server-py",
129+
"/Users/pkesari/Desktop/WorkProjects/microservice-log-analyzer/opensearch-mcp-server-py",
127130
"run",
128131
"--",
129132
"python",
@@ -264,10 +267,10 @@
264267
connection_params=StdioConnectionParams(
265268
timeout=1000.0,
266269
server_params=StdioServerParameters(
267-
command="/Users/sarangsa/.local/bin/uv",
270+
command=UV_PATH,
268271
args=[
269272
"--directory",
270-
"/Users/sarangsa/Code/microservice-log-analyzer/opensearch-mcp-server-py",
273+
"/Users/pkesari/Desktop/WorkProjects/microservice-log-analyzer/opensearch-mcp-server-py",
271274
"run",
272275
"--",
273276
"python",
@@ -402,10 +405,10 @@
402405
connection_params=StdioConnectionParams(
403406
timeout=1000.0,
404407
server_params=StdioServerParameters(
405-
command="/Users/sarangsa/.local/bin/uv",
408+
command=UV_PATH,
406409
args=[
407410
"--directory",
408-
"/Users/sarangsa/Code/microservice-log-analyzer/opensearch-mcp-server-py",
411+
"/Users/pkesari/Desktop/WorkProjects/microservice-log-analyzer/opensearch-mcp-server-py",
409412
"run",
410413
"--",
411414
"python",

log-analyzer-frontend/app/api/adk-proxy/route.ts

Lines changed: 0 additions & 109 deletions
This file was deleted.

log-analyzer-frontend/lib/session-manager.ts

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
const ADK_API_URL = process.env.NEXT_PUBLIC_ADK_API_URL || "http://127.0.0.1:8000"
2+
13
export class SessionManager {
24
private userId: string
35
private sessionId: string
@@ -17,18 +19,22 @@ export class SessionManager {
1719
const controller = new AbortController()
1820
const timeoutId = setTimeout(() => controller.abort(), 600000) // 10 minutes
1921

20-
const response = await fetch("/api/adk-proxy", {
22+
const response = await fetch(
23+
`${ADK_API_URL}/apps/root_agent/users/${this.userId}/sessions/${this.sessionId}`,
24+
{
2125
method: "POST",
2226
headers: {
2327
"Content-Type": "application/json",
2428
},
25-
body: JSON.stringify({
26-
action: "createSession",
27-
userId: this.userId,
28-
sessionId: this.sessionId,
29-
}),
30-
signal: controller.signal,
31-
})
29+
body: JSON.stringify({
30+
state: {
31+
initialized: true,
32+
timestamp: new Date().toISOString(),
33+
},
34+
}),
35+
signal: controller.signal,
36+
}
37+
)
3238

3339
clearTimeout(timeoutId)
3440

@@ -51,16 +57,23 @@ export class SessionManager {
5157
const controller = new AbortController()
5258
const timeoutId = setTimeout(() => controller.abort(), 600000) // 10 minutes
5359

54-
const response = await fetch("/api/adk-proxy", {
60+
const response = await fetch(`${ADK_API_URL}/run`, {
5561
method: "POST",
5662
headers: {
5763
"Content-Type": "application/json",
5864
},
5965
body: JSON.stringify({
60-
action: "sendQuery",
66+
appName: "root_agent",
6167
userId: this.userId,
6268
sessionId: this.sessionId,
63-
searchParams,
69+
newMessage: {
70+
role: "user",
71+
parts: [
72+
{
73+
text: JSON.stringify(searchParams),
74+
},
75+
],
76+
},
6477
}),
6578
signal: controller.signal,
6679
})
@@ -95,18 +108,13 @@ export class SessionManager {
95108
const controller = new AbortController()
96109
const timeoutId = setTimeout(() => controller.abort(), 30000) // 30 seconds
97110

98-
await fetch("/api/adk-proxy", {
99-
method: "POST",
100-
headers: {
101-
"Content-Type": "application/json",
102-
},
103-
body: JSON.stringify({
104-
action: "deleteSession",
105-
userId: this.userId,
106-
sessionId: this.sessionId,
107-
}),
108-
signal: controller.signal,
109-
})
111+
await fetch(
112+
`${ADK_API_URL}/apps/root_agent/users/${this.userId}/sessions/${this.sessionId}`,
113+
{
114+
method: "DELETE",
115+
signal: controller.signal,
116+
}
117+
)
110118

111119
clearTimeout(timeoutId)
112120
this.sessionCreated = false

0 commit comments

Comments
 (0)