feat(dev): open the agent inspector from project dev - #2013
Open
tejaskash wants to merge 11 commits into
Open
Conversation
tejaskash
had a problem deploying
to
e2e-testing
August 17, 2026 19:18 — with
GitHub Actions
Failure
tejaskash
had a problem deploying
to
e2e-testing
August 17, 2026 20:18 — with
GitHub Actions
Failure
tejaskash
force-pushed
the
feat/dev-otel-collector
branch
from
August 18, 2026 18:16
7e315b9 to
aabb87f
Compare
…ream HTTP bodies TraceStore becomes raw per-trace persistence; frontend shaping (meta, detail, noise filtering) moves to core/dev/inspector with an InspectorTraceSource query wrapper. io/httpServer responses can now stream AsyncIterable bodies for SSE.
Agents start on demand (the Inspector's POST /api/start path), each in an abort scope chained to the command signal for its whole lifetime, with every runner's events merged into one attributed stream for the dev handler to render. Start dedup and retry-after-failure fall out of a per-agent state machine.
Stage @aws/agent-inspector's prebuilt dist-assets into the (gitignored) asset tree at build time so the npm bundle mirrors it into dist/assets and compiled binaries embed it — zero new distribution-aware code. At runtime InspectorAssets resolves AGENT_INSPECTOR_PATH (SPA development), then the staged assets, then node_modules (running from source before a build).
Bun.build bundles bare .html entrypoints through its HTML-imports pipeline (colliding with the SPA's own index.js) instead of embedding them verbatim. Staged files carry an .asset suffix that InspectorAssets strips on read.
createInspectorHandler composes a pure request handler for the Inspector SPA over consumer-owned dependency interfaces (supervisor, traces, static assets, project, optional AWS capabilities). Ports the reference web-ui server's security model (loopback Host check, origin allowlist, X-Agentcore-Local on POSTs, CORS preflight) and its wire contract: status, start, protocol-aware /invocations proxying (HTTP/A2A/AGUI SSE translation, deployed runtimes, harness invocations), local and deployed MCP proxying, A2A agent cards, local and CloudWatch traces, memory browsing/search, the project resource graph, and SPA static serving with an index.html fallback. AWS-backed routes degrade to 404 error envelopes when their capability is not wired.
project dev now supervises every runtime and serves the Inspector UI (auto-opening the browser on interactive terminals only; --no-ui restores plain single-runtime streaming, --ui-port pins the UI port). Events from all agents render agent-attributed in human and NDJSON output.
…ency Watch the project config so the Inspector's agent list follows edits without a restart (running agents survive removal until they stop). Cache decoded SPA assets outside SPA-dev mode, skip body buffering on GET/HEAD, and drain the supervisor's event queue in batches.
project deploy is still a stub on the refactor branch, so nothing can ever inject the aws capabilities: the deployed invocation/MCP, harness, memory, CloudWatch trace, and deployed-state resource routes were unreachable dead surface that always answered 404. Remove them and their dep interfaces, wire types, and tests; unknown /api paths keep returning the same JSON 404 the SPA already handles. They return with real wiring when deploy lands.
Only StatusResponse and ResourcesResponse were referenced, each annotating a literal that already expresses the exact SPA wire shape; the other 15 interfaces had no references at all. The literals stay the documented contract.
tejaskash
force-pushed
the
feat/agent-inspector
branch
from
August 18, 2026 18:18
7cb567a to
937d318
Compare
tejaskash
had a problem deploying
to
e2e-testing
August 18, 2026 18:19 — with
GitHub Actions
Failure
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
agentcore project devnow opens the Agent Inspector — the local web UI from the current CLI — by default. The browser opens automatically on an interactive terminal (never in scripts or--json), the URL always prints, and--no-uirestores plain log streaming. From the UI you can see every runtime in the project, start any of them with a click, chat with a running agent, and browse its traces as they arrive. Edits toagentcore.jsonreload the agent list live. The web UI itself is the unmodified@aws/agent-inspectorpackage — this PR provides everything behind it.Scope: local dev loop only, deliberately
This PR is at full parity with the current CLI for everything reachable in the refactor today: supervise and lazily start all runtimes, chat over HTTP/SSE, local MCP + A2A + AGUI proxying, live traces, resources view, config-watch reload, the same security guards (loopback Host check, origin allowlist,
X-Agentcore-Localon POSTs).What it intentionally does not include: the deployed-target features of the current CLI's dev UI (invoke deployed agents, deployed memory records, CloudWatch traces, harness invocation).
project deployis still a stub onrefactor, so those features would be dead code behind unreachable routes — an earlier draft carried them as unwired interfaces and a review rightly called that out (~1,200 lines removed). The SPA already degrades gracefully on their 404s; they return together with real wiring when deploy lands. One known cosmetic difference: agent ports scan per-protocol defaults rather than mainline'suiPort+1+indexscheme.How it fits together
DevSupervisor(core/dev/supervisor.ts) — agents start lazily when the browser asks, each in an abort scope chained to Ctrl-C for its whole lifetime; all runner output merges into one agent-attributed stream ([hello_world] ...in the terminal, anagentfield in NDJSON). Hot reload stays inside the child (uvicorn --reload/tsx watch);setRuntimesapplies config edits without touching running agents.core/dev/inspector/) — the local route surface ported wire-compatibly from the current CLI's web-ui: status, start, protocol-aware/invocations, traces,/api/mcp, A2A agent card, resources, static SPA with SPA-routing fallback and per-process asset caching.TraceStoreis raw per-trace persistence; frontend shaping (flattening, noise filtering) lives incore/dev/inspector/.io/httpServerstreamsAsyncIterablebodies for SSE, skips body buffering on GET/HEAD, and caps request sizes..htmlentrypoints through its HTML-imports pipeline, so staged files carry a neutral.assetsuffix stripped on read.AGENT_INSPECTOR_PATHoverrides for SPA development (uncached).How it was tested
Beyond the unit/route suite (1,595 tests green): a full end-to-end session against a real project and a real Bedrock call — built the npm bundle, scaffolded a project with
project create(realuv sync), ranproject dev, and drove the Inspector with Playwright from the browser origin: SPA renders, agent starts via the UI (CORS + local-header guards exercised), an invocation streams back from Bedrock through the proxy, traces appear in the timeline with span counts, trace detail resolves by id, and foreign-origin POSTs are rejected 403. 10/10 checks, re-run after the trim. A separate headed session via the Playwright MCP server confirmed the same flow interactively (chat answered live, span waterfall rendered).Stack
Stacks on #1980 (
feat/dev-otel-collector); retarget as the stack merges. Together they complete the local dev-loop plan: #1980 collects traces, this PR shows them. Follow-up (blocked on deploy landing in the refactor): wire the deployed-target Inspector capabilities.