feat: add agent roster observability APIs (#37566)

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
zyssyz123andautofix-ci[bot] authored and GitHub committed 2026-06-17 05:22:52 +00:00
1 parent f992ede836
commit e970cbde0f
10 files changed
+1339 -21

No files matched your search

@@ -29,6 +29,9 @@ import {
zGetAgentByAgentIdDriveFilesPreviewResponse,
zGetAgentByAgentIdDriveFilesQuery,
zGetAgentByAgentIdDriveFilesResponse,
zGetAgentByAgentIdLogsPath,
zGetAgentByAgentIdLogsQuery,
zGetAgentByAgentIdLogsResponse,
zGetAgentByAgentIdMessagesByMessageIdPath,
zGetAgentByAgentIdMessagesByMessageIdResponse,
zGetAgentByAgentIdPath,
@@ -41,6 +44,9 @@ import {
zGetAgentByAgentIdSandboxFilesReadQuery,
zGetAgentByAgentIdSandboxFilesReadResponse,
zGetAgentByAgentIdSandboxFilesResponse,
zGetAgentByAgentIdStatisticsSummaryPath,
zGetAgentByAgentIdStatisticsSummaryQuery,
zGetAgentByAgentIdStatisticsSummaryResponse,
zGetAgentByAgentIdVersionsByVersionIdPath,
zGetAgentByAgentIdVersionsByVersionIdResponse,
zGetAgentByAgentIdVersionsPath,
@@ -391,10 +397,27 @@ export const files2 = {
post: post5,
}
export const get9 = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'getAgentByAgentIdLogs',
path: '/agent/{agent_id}/logs',
tags: ['console'],
})
.input(
z.object({ params: zGetAgentByAgentIdLogsPath, query: zGetAgentByAgentIdLogsQuery.optional() }),
)
.output(zGetAgentByAgentIdLogsResponse)
export const logs = {
get: get9,
}
/**
* Get Agent App message details by ID
*/
export const get9 = oc
export const get10 = oc
.route({
description: 'Get Agent App message details by ID',
inputStructure: 'detailed',
@@ -407,7 +430,7 @@ export const get9 = oc
.output(zGetAgentByAgentIdMessagesByMessageIdResponse)
export const byMessageId2 = {
get: get9,
get: get10,
}
export const messages = {
@@ -417,7 +440,7 @@ export const messages = {
/**
* List workflow apps that reference this Agent App's bound Agent (read-only)
*/
export const get10 = oc
export const get11 = oc
.route({
description: 'List workflow apps that reference this Agent App\'s bound Agent (read-only)',
inputStructure: 'detailed',
@@ -430,13 +453,13 @@ export const get10 = oc
.output(zGetAgentByAgentIdReferencingWorkflowsResponse)
export const referencingWorkflows = {
get: get10,
get: get11,
}
/**
* Read a text/binary preview file in an Agent App conversation sandbox
*/
export const get11 = oc
export const get12 = oc
.route({
description: 'Read a text/binary preview file in an Agent App conversation sandbox',
inputStructure: 'detailed',
@@ -454,7 +477,7 @@ export const get11 = oc
.output(zGetAgentByAgentIdSandboxFilesReadResponse)
export const read = {
get: get11,
get: get12,
}
/**
@@ -484,7 +507,7 @@ export const upload = {
/**
* List a directory in an Agent App conversation sandbox
*/
export const get12 = oc
export const get13 = oc
.route({
description: 'List a directory in an Agent App conversation sandbox',
inputStructure: 'detailed',
@@ -502,7 +525,7 @@ export const get12 = oc
.output(zGetAgentByAgentIdSandboxFilesResponse)
export const files3 = {
get: get12,
get: get13,
read,
upload,
}
@@ -596,7 +619,31 @@ export const skills = {
bySlug,
}
export const get13 = oc
export const get14 = oc
.route({
inputStructure: 'detailed',
method: 'GET',
operationId: 'getAgentByAgentIdStatisticsSummary',
path: '/agent/{agent_id}/statistics/summary',
tags: ['console'],
})
.input(
z.object({
params: zGetAgentByAgentIdStatisticsSummaryPath,
query: zGetAgentByAgentIdStatisticsSummaryQuery.optional(),
}),
)
.output(zGetAgentByAgentIdStatisticsSummaryResponse)
export const summary = {
get: get14,
}
export const statistics = {
summary,
}
export const get15 = oc
.route({
inputStructure: 'detailed',
method: 'GET',
@@ -608,10 +655,10 @@ export const get13 = oc
.output(zGetAgentByAgentIdVersionsByVersionIdResponse)
export const byVersionId = {
get: get13,
get: get15,
}
export const get14 = oc
export const get16 = oc
.route({
inputStructure: 'detailed',
method: 'GET',
@@ -623,7 +670,7 @@ export const get14 = oc
.output(zGetAgentByAgentIdVersionsResponse)
export const versions = {
get: get14,
get: get16,
byVersionId,
}
@@ -639,7 +686,7 @@ export const delete3 = oc
.input(z.object({ params: zDeleteAgentByAgentIdPath }))
.output(zDeleteAgentByAgentIdResponse)
export const get15 = oc
export const get17 = oc
.route({
inputStructure: 'detailed',
method: 'GET',
@@ -663,7 +710,7 @@ export const put2 = oc
export const byAgentId = {
delete: delete3,
get: get15,
get: get17,
put: put2,
chatMessages,
composer,
@@ -671,14 +718,16 @@ export const byAgentId = {
features,
feedbacks,
files: files2,
logs,
messages,
referencingWorkflows,
sandbox,
skills,
statistics,
versions,
}
export const get16 = oc
export const get18 = oc
.route({
inputStructure: 'detailed',
method: 'GET',
@@ -702,7 +751,7 @@ export const post10 = oc
.output(zPostAgentResponse)
export const agent = {
get: get16,
get: get18,
post: post10,
inviteOptions,
byAgentId,
@@ -169,6 +169,14 @@ export type AgentDriveFileCommitResponse = {
file: AgentDriveFileResponse
}
export type AgentLogListResponse = {
data: Array<AgentLogItemResponse>
has_more: boolean
limit: number
page: number
total: number
}
export type MessageDetailResponse = {
agent_thoughts?: Array<AgentThought>
annotation?: ConversationAnnotation | null
@@ -242,6 +250,12 @@ export type SkillToolInferenceResult = {
reason?: string | null
}
export type AgentStatisticSummaryEnvelopeResponse = {
charts: AgentStatisticChartsResponse
source: string
summary: AgentStatisticSummaryResponse
}
export type AgentConfigSnapshotListResponse = {
data: Array<AgentConfigSnapshotSummaryResponse>
}
@@ -530,6 +544,29 @@ export type AgentDriveFileResponse = {
size?: number | null
}
export type AgentLogItemResponse = {
answer: string
answer_tokens: number
conversation_id: string
conversation_name?: string | null
created_at?: number | null
currency: string
error?: string | null
from_account_id?: string | null
from_end_user_id?: string | null
from_source?: string | null
id: string
latency: number
message_id: string
message_tokens: number
query: string
source?: string | null
status: string
total_price: string
total_tokens: number
updated_at?: number | null
}
export type AgentThought = {
chain_id?: string | null
created_at?: number | null
@@ -644,6 +681,30 @@ export type CliToolSuggestion = {
name: string
}
export type AgentStatisticChartsResponse = {
average_response_time?: Array<AgentAverageResponseTimeStatisticResponse>
average_session_interactions?: Array<AgentAverageSessionInteractionStatisticResponse>
daily_conversations?: Array<AgentDailyConversationStatisticResponse>
daily_end_users?: Array<AgentDailyEndUserStatisticResponse>
daily_messages?: Array<AgentDailyMessageStatisticResponse>
token_usage?: Array<AgentTokenUsageStatisticResponse>
tokens_per_second?: Array<AgentTokensPerSecondStatisticResponse>
user_satisfaction_rate?: Array<AgentUserSatisfactionRateStatisticResponse>
}
export type AgentStatisticSummaryResponse = {
average_response_time: number
average_session_interactions: number
currency: string
tokens_per_second: number
total_conversations: number
total_end_users: number
total_messages: number
total_price: string
total_tokens: number
user_satisfaction_rate: number
}
export type AgentConfigRevisionResponse = {
created_at?: number | null
created_by?: string | null
@@ -953,6 +1014,48 @@ export type EnvSuggestion = {
secret_likely?: boolean
}
export type AgentAverageResponseTimeStatisticResponse = {
date: string
latency: number
}
export type AgentAverageSessionInteractionStatisticResponse = {
date: string
interactions: number
}
export type AgentDailyConversationStatisticResponse = {
conversation_count: number
date: string
}
export type AgentDailyEndUserStatisticResponse = {
date: string
terminal_count: number
}
export type AgentDailyMessageStatisticResponse = {
date: string
message_count: number
}
export type AgentTokenUsageStatisticResponse = {
currency: string
date: string
token_count: number
total_price: string
}
export type AgentTokensPerSecondStatisticResponse = {
date: string
tps: number
}
export type AgentUserSatisfactionRateStatisticResponse = {
date: string
rate: number
}
export type AgentConfigRevisionOperation
= | 'create_version'
| 'save_current_version'
@@ -1717,6 +1820,30 @@ export type PostAgentByAgentIdFilesResponses = {
export type PostAgentByAgentIdFilesResponse
= PostAgentByAgentIdFilesResponses[keyof PostAgentByAgentIdFilesResponses]
export type GetAgentByAgentIdLogsData = {
body?: never
path: {
agent_id: string
}
query?: {
end?: string
keyword?: string
limit?: number
page?: number
source?: string
start?: string
status?: string
}
url: '/agent/{agent_id}/logs'
}
export type GetAgentByAgentIdLogsResponses = {
200: AgentLogListResponse
}
export type GetAgentByAgentIdLogsResponse
= GetAgentByAgentIdLogsResponses[keyof GetAgentByAgentIdLogsResponses]
export type GetAgentByAgentIdMessagesByMessageIdData = {
body?: never
path: {
@@ -1886,6 +2013,26 @@ export type PostAgentByAgentIdSkillsBySlugInferToolsResponses = {
export type PostAgentByAgentIdSkillsBySlugInferToolsResponse
= PostAgentByAgentIdSkillsBySlugInferToolsResponses[keyof PostAgentByAgentIdSkillsBySlugInferToolsResponses]
export type GetAgentByAgentIdStatisticsSummaryData = {
body?: never
path: {
agent_id: string
}
query?: {
end?: string
source?: string
start?: string
}
url: '/agent/{agent_id}/statistics/summary'
}
export type GetAgentByAgentIdStatisticsSummaryResponses = {
200: AgentStatisticSummaryEnvelopeResponse
}
export type GetAgentByAgentIdStatisticsSummaryResponse
= GetAgentByAgentIdStatisticsSummaryResponses[keyof GetAgentByAgentIdStatisticsSummaryResponses]
export type GetAgentByAgentIdVersionsData = {
body?: never
path: {
@@ -321,6 +321,43 @@ export const zAgentDriveFileCommitResponse = z.object({
file: zAgentDriveFileResponse,
})
/**
* AgentLogItemResponse
*/
export const zAgentLogItemResponse = z.object({
answer: z.string(),
answer_tokens: z.int(),
conversation_id: z.string(),
conversation_name: z.string().nullish(),
created_at: z.int().nullish(),
currency: z.string(),
error: z.string().nullish(),
from_account_id: z.string().nullish(),
from_end_user_id: z.string().nullish(),
from_source: z.string().nullish(),
id: z.string(),
latency: z.number(),
message_id: z.string(),
message_tokens: z.int(),
query: z.string(),
source: z.string().nullish(),
status: z.string(),
total_price: z.string(),
total_tokens: z.int(),
updated_at: z.int().nullish(),
})
/**
* AgentLogListResponse
*/
export const zAgentLogListResponse = z.object({
data: z.array(zAgentLogItemResponse),
has_more: z.boolean(),
limit: z.int(),
page: z.int(),
total: z.int(),
})
/**
* AgentThought
*/
@@ -458,6 +495,22 @@ export const zAgentSkillUploadResponse = z.object({
skill: zAgentSkillRefConfig,
})
/**
* AgentStatisticSummaryResponse
*/
export const zAgentStatisticSummaryResponse = z.object({
average_response_time: z.number(),
average_session_interactions: z.number(),
currency: z.string(),
tokens_per_second: z.number(),
total_conversations: z.int(),
total_end_users: z.int(),
total_messages: z.int(),
total_price: z.string(),
total_tokens: z.int(),
user_satisfaction_rate: z.number(),
})
/**
* ModelConfigPartial
*/
@@ -885,6 +938,97 @@ export const zSkillToolInferenceResult = z.object({
reason: z.string().nullish(),
})
/**
* AgentAverageResponseTimeStatisticResponse
*/
export const zAgentAverageResponseTimeStatisticResponse = z.object({
date: z.string(),
latency: z.number(),
})
/**
* AgentAverageSessionInteractionStatisticResponse
*/
export const zAgentAverageSessionInteractionStatisticResponse = z.object({
date: z.string(),
interactions: z.number(),
})
/**
* AgentDailyConversationStatisticResponse
*/
export const zAgentDailyConversationStatisticResponse = z.object({
conversation_count: z.int(),
date: z.string(),
})
/**
* AgentDailyEndUserStatisticResponse
*/
export const zAgentDailyEndUserStatisticResponse = z.object({
date: z.string(),
terminal_count: z.int(),
})
/**
* AgentDailyMessageStatisticResponse
*/
export const zAgentDailyMessageStatisticResponse = z.object({
date: z.string(),
message_count: z.int(),
})
/**
* AgentTokenUsageStatisticResponse
*/
export const zAgentTokenUsageStatisticResponse = z.object({
currency: z.string(),
date: z.string(),
token_count: z.int(),
total_price: z.string(),
})
/**
* AgentTokensPerSecondStatisticResponse
*/
export const zAgentTokensPerSecondStatisticResponse = z.object({
date: z.string(),
tps: z.number(),
})
/**
* AgentUserSatisfactionRateStatisticResponse
*/
export const zAgentUserSatisfactionRateStatisticResponse = z.object({
date: z.string(),
rate: z.number(),
})
/**
* AgentStatisticChartsResponse
*/
export const zAgentStatisticChartsResponse = z.object({
average_response_time: z.array(zAgentAverageResponseTimeStatisticResponse).optional(),
average_session_interactions: z
.array(zAgentAverageSessionInteractionStatisticResponse)
.optional(),
daily_conversations: z.array(zAgentDailyConversationStatisticResponse).optional(),
daily_end_users: z.array(zAgentDailyEndUserStatisticResponse).optional(),
daily_messages: z.array(zAgentDailyMessageStatisticResponse).optional(),
token_usage: z.array(zAgentTokenUsageStatisticResponse).optional(),
tokens_per_second: z.array(zAgentTokensPerSecondStatisticResponse).optional(),
user_satisfaction_rate: z.array(zAgentUserSatisfactionRateStatisticResponse).optional(),
})
/**
* AgentStatisticSummaryEnvelopeResponse
*/
export const zAgentStatisticSummaryEnvelopeResponse = z.object({
charts: zAgentStatisticChartsResponse,
source: z.string(),
summary: zAgentStatisticSummaryResponse,
})
/**
* AgentConfigRevisionOperation
*
@@ -2106,6 +2250,25 @@ export const zPostAgentByAgentIdFilesPath = z.object({
*/
export const zPostAgentByAgentIdFilesResponse = zAgentDriveFileCommitResponse
export const zGetAgentByAgentIdLogsPath = z.object({
agent_id: z.string(),
})
export const zGetAgentByAgentIdLogsQuery = z.object({
end: z.string().optional(),
keyword: z.string().optional(),
limit: z.int().gte(1).lte(100).optional().default(20),
page: z.int().gte(1).optional().default(1),
source: z.string().optional(),
start: z.string().optional(),
status: z.string().optional(),
})
/**
* Agent logs
*/
export const zGetAgentByAgentIdLogsResponse = zAgentLogListResponse
export const zGetAgentByAgentIdMessagesByMessageIdPath = z.object({
agent_id: z.string(),
message_id: z.string(),
@@ -2202,6 +2365,21 @@ export const zPostAgentByAgentIdSkillsBySlugInferToolsPath = z.object({
*/
export const zPostAgentByAgentIdSkillsBySlugInferToolsResponse = zSkillToolInferenceResult
export const zGetAgentByAgentIdStatisticsSummaryPath = z.object({
agent_id: z.string(),
})
export const zGetAgentByAgentIdStatisticsSummaryQuery = z.object({
end: z.string().optional(),
source: z.string().optional(),
start: z.string().optional(),
})
/**
* Agent monitoring summary and chart data
*/
export const zGetAgentByAgentIdStatisticsSummaryResponse = zAgentStatisticSummaryEnvelopeResponse
export const zGetAgentByAgentIdVersionsPath = z.object({
agent_id: z.string(),
})