Skip to content

Add the ai-agent commands for the conversations the AI Sessionizer lands - #234

Merged
wu-sheng merged 1 commit into
masterfrom
ai-agent-conversation
Sep 5, 2026
Merged

Add the ai-agent commands for the conversations the AI Sessionizer lands#234
wu-sheng merged 1 commit into
masterfrom
ai-agent-conversation

Conversation

@wu-sheng

@wu-sheng wu-sheng commented Sep 5, 2026

Copy link
Copy Markdown
Member

What

The OAP (apache/skywalking 11.1.0, branch feat/ai-agent-conversation, not yet merged) stores the conversations of long-lived AI agents that the AI Sessionizer pushes under the AI_AGENT layer, and serves them through two GraphQL queries and one streamed HTTP route. swctl gains a command group for them:

Command Reads From
ai-agent list one row per conversation of a service, newest first, with the sender filter and --limit GraphQL listConversations
ai-agent files the raw files as stored; --export DIR writes each body to its id path, a storage root asz verify and asz view read GraphQL getConversationRawFiles, body @include on export
ai-agent view the whole conversation as one asz.view 1.0 document, JSON or --yaml, streamed to stdout or --output GET /ai-agent/conversations/{id}/v1/view on the --base-url host

Why the view is not a GraphQL query

A long conversation renders to tens of megabytes (a 136 MB session folds to a 70 MB document), so the OAP serves it from a streamed route on the query host beside /graphql, with Content-Type: application/vnd.skywalking.asz.view+json; version=1.0 (or +yaml) and errors as application/problem+json. pkg/aiagent/view is therefore a small streaming client of its own rather than a use of the admin REST client, which is bound to the admin host and buffers bodies: it derives the host from --base-url, shares TLS and basic auth through pkg/transport, copies the body through, and turns a problem document into the error.

Other changes

Dependencies

Verification

  • Unit tests run the view client against an in-process server: JSON and YAML bodies, streaming, the instance parameter, and the 400, 404 and 500 problem paths.
  • The end-to-end check lives in the OAP repository, not here: the OAP's ai-agent e2e builds sessions with the Sessionizer, pushes them to the OAP built from that PR, and reads every conversation back through swctl ai-agent list, files and view. It passed 10/10 locally with this branch's binary; once this PR merges, the OAP e2e pins the merged commit as SW_CTL_COMMIT and runs it in CI.

@wu-sheng
wu-sheng force-pushed the ai-agent-conversation branch 3 times, most recently from b4afd1d to fe36f39 Compare September 5, 2026 02:54
@wu-sheng wu-sheng added this to the 0.15.0 milestone Sep 5, 2026
@wu-sheng wu-sheng added the enhancement New feature or request label Sep 5, 2026
@wu-sheng
wu-sheng requested a review from kezhenxu94 September 5, 2026 02:56
kezhenxu94
kezhenxu94 previously approved these changes Sep 5, 2026
The OAP (11.1.0) stores the conversations of long-lived AI agents that
the AI Sessionizer pushes under the AI_AGENT layer, and serves them
through two GraphQL queries and one streamed HTTP route. swctl gains:

  ai-agent list     one row per conversation of a service, newest first
  ai-agent files    the raw files as stored, or --export DIR to rebuild
                    a storage root that asz verify and asz view read
  ai-agent view     the whole conversation as one asz.view document,
                    from GET /ai-agent/conversations/{id}/v1/view on the
                    --base-url host, streamed to stdout or --output,
                    JSON or --yaml, with the route's problem document
                    turned into the error

The view route lives on the query host beside /graphql, not on the
admin host, and its body can be tens of megabytes, so it has its own
small streaming client rather than the admin REST client.

goapi is bumped to the regeneration that carries the conversation
types. That regeneration also dropped MenuItem, since the protocol
retired getMenuItems; the menu command keeps the shape locally for the
backends before 11.0.0.

The e2e builds three sessions with the Sessionizer's scenario tool,
pushes them to an OAP, and checks every command, the export included.
@wu-sheng
wu-sheng merged commit 1b6837d into master Sep 5, 2026
7 checks passed
@wu-sheng
wu-sheng deleted the ai-agent-conversation branch September 5, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants