mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-07-17 09:56:06 +00:00
feat(agent): add event orchestration surface
This commit is contained in:
committed by
huanghuoguoguo
parent
3dd49a8a6e
commit
59e0edb3d5
@@ -138,6 +138,45 @@ export interface ApiRespPipelines {
|
||||
pipelines: Pipeline[];
|
||||
}
|
||||
|
||||
export type AgentKind = 'agent' | 'pipeline';
|
||||
|
||||
export interface AgentCapability {
|
||||
supported_event_patterns: string[];
|
||||
message_only: boolean;
|
||||
}
|
||||
|
||||
export interface Agent {
|
||||
uuid?: string;
|
||||
name: string;
|
||||
description: string;
|
||||
emoji?: string;
|
||||
kind: AgentKind;
|
||||
component_ref?: string | null;
|
||||
config?: Record<string, unknown>;
|
||||
enabled?: boolean;
|
||||
supported_event_patterns?: string[];
|
||||
capability?: AgentCapability;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
}
|
||||
|
||||
export interface ApiRespAgents {
|
||||
agents: Agent[];
|
||||
}
|
||||
|
||||
export interface ApiRespAgent {
|
||||
agent: Agent;
|
||||
}
|
||||
|
||||
export interface GetAgentMetadataResponseData {
|
||||
runner_config?: PipelineConfigTab;
|
||||
kinds: Array<{
|
||||
name: AgentKind;
|
||||
supported_event_patterns: string[];
|
||||
message_only: boolean;
|
||||
}>;
|
||||
}
|
||||
|
||||
export interface Pipeline {
|
||||
uuid?: string;
|
||||
name: string;
|
||||
@@ -167,6 +206,8 @@ export interface Adapter {
|
||||
spec: {
|
||||
categories?: string[];
|
||||
help_links?: Record<string, string>;
|
||||
supported_events?: string[];
|
||||
supported_apis?: string[];
|
||||
config: IDynamicFormItemSchema[];
|
||||
};
|
||||
}
|
||||
@@ -189,6 +230,7 @@ export interface Bot {
|
||||
use_pipeline_name?: string;
|
||||
use_pipeline_uuid?: string;
|
||||
pipeline_routing_rules?: PipelineRoutingRule[];
|
||||
event_bindings?: EventBinding[];
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
adapter_runtime_values?: object;
|
||||
@@ -213,6 +255,18 @@ export interface PipelineRoutingRule {
|
||||
pipeline_uuid: string;
|
||||
}
|
||||
|
||||
export interface EventBinding {
|
||||
id?: string;
|
||||
event_pattern: string;
|
||||
target_type: 'agent' | 'pipeline' | 'discard';
|
||||
target_uuid: string;
|
||||
filters?: Array<Record<string, unknown>>;
|
||||
priority: number;
|
||||
enabled: boolean;
|
||||
description?: string;
|
||||
order?: number;
|
||||
}
|
||||
|
||||
export interface ApiRespKnowledgeBases {
|
||||
bases: KnowledgeBase[];
|
||||
}
|
||||
|
||||
@@ -6,6 +6,9 @@ import {
|
||||
ApiRespProviderLLMModel,
|
||||
LLMModel,
|
||||
ApiRespPipelines,
|
||||
ApiRespAgents,
|
||||
ApiRespAgent,
|
||||
Agent,
|
||||
Pipeline,
|
||||
ApiRespPlatformAdapters,
|
||||
ApiRespPlatformAdapter,
|
||||
@@ -22,6 +25,7 @@ import {
|
||||
ApiRespUserToken,
|
||||
GetPipelineResponseData,
|
||||
GetPipelineMetadataResponseData,
|
||||
GetAgentMetadataResponseData,
|
||||
AsyncTask,
|
||||
ApiRespWebChatMessages,
|
||||
ApiRespKnowledgeBases,
|
||||
@@ -229,6 +233,37 @@ export class BackendClient extends BaseHttpClient {
|
||||
}
|
||||
|
||||
// ============ Pipeline API ============
|
||||
public getAgents(
|
||||
sortBy?: string,
|
||||
sortOrder?: string,
|
||||
): Promise<ApiRespAgents> {
|
||||
const params = new URLSearchParams();
|
||||
if (sortBy) params.append('sort_by', sortBy);
|
||||
if (sortOrder) params.append('sort_order', sortOrder);
|
||||
const queryString = params.toString();
|
||||
return this.get(`/api/v1/agents${queryString ? `?${queryString}` : ''}`);
|
||||
}
|
||||
|
||||
public getAgent(uuid: string): Promise<ApiRespAgent> {
|
||||
return this.get(`/api/v1/agents/${uuid}`);
|
||||
}
|
||||
|
||||
public getAgentMetadata(): Promise<GetAgentMetadataResponseData> {
|
||||
return this.get('/api/v1/agents/_/metadata');
|
||||
}
|
||||
|
||||
public createAgent(agent: Agent): Promise<{ uuid: string; kind: string }> {
|
||||
return this.post('/api/v1/agents', agent);
|
||||
}
|
||||
|
||||
public updateAgent(uuid: string, agent: Partial<Agent>): Promise<object> {
|
||||
return this.put(`/api/v1/agents/${uuid}`, agent);
|
||||
}
|
||||
|
||||
public deleteAgent(uuid: string): Promise<object> {
|
||||
return this.delete(`/api/v1/agents/${uuid}`);
|
||||
}
|
||||
|
||||
public getGeneralPipelineMetadata(): Promise<GetPipelineMetadataResponseData> {
|
||||
// as designed, this method will be deprecated, and only for developer to check the prefered config schema
|
||||
return this.get('/api/v1/pipelines/_/metadata');
|
||||
|
||||
Reference in New Issue
Block a user