Skip to content

Commit 111dad5

Browse files
Peter-SL5claude
andcommitted
Add dashboard to demo stack
- docker-compose.demo.yml: add otel-collector and dashboard services. otel-collector bridges gateway OTLP gRPC (4317) to the dashboard. dashboard builds from sibling ../agent-gateway-dashboard repo. - demo/setup.sh: start otel-collector and dashboard alongside gateway; pass AGENT_GATEWAY_DEMO_DASHBOARD_URL to demo env; print dashboard URL in the ready message. - demo/demo-agent.sh: emit agent.requested and agent.prompted events to POST /api/events on the dashboard when a prompt is dispatched, lighting up the alice→agent-platform and agent-platform→agent edges. - .gitignore: exclude /agent-gateway-dashboard/ (sibling repo checked out inside this directory during development). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent bb03d1d commit 111dad5

4 files changed

Lines changed: 50 additions & 2 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
/target
22
.cursor/
33
__pycache__/
4+
/agent-gateway-dashboard/
5+
.run/
6+
/certs/
7+
/config.toml

demo/demo-agent.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ DEFAULT_SWTPM_PORT="${AGENT_GATEWAY_DEMO_SWTPM_PORT:-2321}"
1515
TPM2_PKCS11_STORE="${TPM2_PKCS11_STORE:-$HOME/.tpm2_pkcs11}"
1616
TOKEN_LABEL="${AGENT_GATEWAY_TPM_TOKEN_LABEL:-agent-gateway}"
1717
USER_PIN="${AGENT_GATEWAY_TPM_USER_PIN:-}"
18+
DASHBOARD_URL="${AGENT_GATEWAY_DEMO_DASHBOARD_URL:-http://localhost:3000}"
1819
export TPM2_PKCS11_STORE
1920

2021
usage() {
@@ -254,6 +255,18 @@ cmd_grant() {
254255
grant_permissions
255256
}
256257

258+
emit_prompt_events() {
259+
local principal="$1" identity="$2"
260+
curl -sf --max-time 2 -X POST "$DASHBOARD_URL/api/events" \
261+
-H 'Content-Type: application/json' \
262+
-d "{\"event_type\":\"agent.requested\",\"source\":\"agent-platform\",\"attributes\":{\"user.id\":\"$principal\",\"agent.id\":\"$identity\"}}" \
263+
>/dev/null || true
264+
curl -sf --max-time 2 -X POST "$DASHBOARD_URL/api/events" \
265+
-H 'Content-Type: application/json' \
266+
-d "{\"event_type\":\"agent.prompted\",\"source\":\"agent-platform\",\"attributes\":{\"agent.id\":\"$identity\"}}" \
267+
>/dev/null || true
268+
}
269+
257270
cmd_prompt() {
258271
[[ $# -ge 1 ]] || { echo "error: prompt requires AGENT_HANDLE" >&2; usage; exit 2; }
259272
HANDLE="$1"
@@ -271,6 +284,7 @@ cmd_prompt() {
271284
done
272285

273286
[[ -n "$PROMPT" ]] || { echo "error: prompt requires --prompt" >&2; exit 2; }
287+
emit_prompt_events "$PRINCIPAL" "$IDENTITY"
274288
ensure_sidecar "$STATE_DIR_CURRENT"
275289
[[ -f "$DEFAULT_MOCK_CA" ]] || {
276290
echo "error: mock service CA file not found: $DEFAULT_MOCK_CA" >&2

demo/setup.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ demo_env=(
123123
"NODE_EXTRA_CA_CERTS=$MOCK_CA"
124124
"SSL_CERT_FILE=$MOCK_CA"
125125
"TPM2_PKCS11_STORE=$TPM2_PKCS11_STORE"
126+
"AGENT_GATEWAY_DEMO_DASHBOARD_URL=http://localhost:3000"
126127
)
127128

128129
select_compose
@@ -140,6 +141,9 @@ if [[ ! -f "$REPO_ROOT/config.toml" ]]; then
140141
echo "==> Creating config.toml from config.example.toml"
141142
cp "$REPO_ROOT/config.example.toml" "$REPO_ROOT/config.toml"
142143
fi
144+
# Ensure the gateway (running in Docker) sends OTLP to the collector service name,
145+
# not localhost (which would be the gateway container itself).
146+
sed -i 's|otlp_endpoint = "http://localhost:4317"|otlp_endpoint = "http://otel-collector:4317"|' "$REPO_ROOT/config.toml"
143147

144148
echo "==> Building local sidecar"
145149
cargo build -p agent_gateway_sidecar
@@ -152,8 +156,8 @@ compose up -d --force-recreate postgres mock-services
152156
wait_for_postgres
153157
apply_migrations
154158

155-
echo "==> Starting gateway"
156-
compose up -d --force-recreate gateway
159+
echo "==> Starting gateway, otel-collector, and dashboard"
160+
compose up -d --force-recreate gateway otel-collector dashboard
157161

158162
echo "==> Registering demo principal $PRINCIPAL"
159163
env "${demo_env[@]}" "$REPO_ROOT/registry-cli/register-principal-key.sh" "$PRINCIPAL"
@@ -195,6 +199,8 @@ cat <<EOF
195199
196200
Demo is ready.
197201
202+
Dashboard: http://localhost:3000
203+
198204
Mock service URLs available through the gateway:
199205
https://docstore/health
200206
https://docstore/documents

docker-compose.demo.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,29 @@ services:
4444
- postgres
4545
- mock-services
4646

47+
otel-collector:
48+
image: otel/opentelemetry-collector:0.111.0
49+
command: ["--config=/etc/otel-collector.yaml"]
50+
volumes:
51+
- ./agent-gateway-dashboard/otel-collector.yaml:/etc/otel-collector.yaml:ro
52+
ports:
53+
- "4317:4317"
54+
depends_on:
55+
postgres:
56+
condition: service_healthy
57+
dashboard:
58+
condition: service_started
59+
60+
dashboard:
61+
build:
62+
context: ./agent-gateway-dashboard
63+
ports:
64+
- "3000:3000"
65+
environment:
66+
AGENT_GATEWAY_DATABASE_URL: postgres://agent_gateway_admin:agent_gateway_dev@postgres:5432/agent_gateway
67+
depends_on:
68+
postgres:
69+
condition: service_healthy
70+
4771
volumes:
4872
agent-gateway-demo-postgres:

0 commit comments

Comments
 (0)