Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
71b1248
feat(agent): add AiAgentConfig for AI agent governance
kylewanginchina Mar 9, 2026
7dd4ff6
feat(agent): add BIZ_TYPE_AI_AGENT constant
kylewanginchina Mar 9, 2026
da42ed1
feat(agent): add ai_agent stub in enterprise-utils
kylewanginchina Mar 9, 2026
a0023c5
feat(agent): add AI agent URL detection hook in HTTP parser
kylewanginchina Mar 9, 2026
17f2cf7
feat(agent): add biz_type to ProcessData and ProcessInfo proto
kylewanginchina Mar 9, 2026
3db3a7e
feat(agent): bypass flow reassembly limits for AI agent traffic
kylewanginchina Mar 9, 2026
8f2e043
feat(ebpf): add access_permission field and AI agent hook point
kylewanginchina Mar 9, 2026
21f384e
feat(agent): wire AiAgentRegistry into agent lifecycle
kylewanginchina Mar 9, 2026
e29d575
fix(agent): add missing L7ProtocolInfoInterface import and fix unused…
kylewanginchina Mar 9, 2026
0cbaf55
fix(ebpf): add null statement after skip_latency_filter label
kylewanginchina Mar 9, 2026
404ef66
feat(agent): AI Agent governance - fix blockers, unlimited reassembly…
kylewanginchina Mar 10, 2026
41a6fb5
fix(agent): fix blocking issues in AI Agent governance event pipeline
kylewanginchina Mar 10, 2026
23c846f
agent/controller: ai agent reassembly and process biz_type
kylewanginchina Mar 10, 2026
48d6d8b
server: add ai_agent config and bump db version
kylewanginchina Mar 10, 2026
3a22c1d
agent: extend endpoints for agent judgement
kylewanginchina Mar 11, 2026
51953ff
agent: fix ai-agent tracepoint hooks
kylewanginchina Mar 11, 2026
f19b469
agent: add ai-agent chmod/chown/unlink tracepoints
kylewanginchina Mar 11, 2026
45cf704
Fix AI Agent cleanup using full proc scan
kylewanginchina Mar 11, 2026
050321e
Fix AI agent pid_tgid usage in socket trace
kylewanginchina Mar 11, 2026
d1d67bd
Reduce AI agent stack usage in data submit
kylewanginchina Mar 11, 2026
e87d92a
Sync biz_type for gprocess in multi-controller
kylewanginchina Mar 11, 2026
732b051
Fix missing is_ai_agent in socket_trace
kylewanginchina Mar 11, 2026
4dc0752
Avoid BPF stack usage for ai_agent flag
kylewanginchina Mar 11, 2026
775863b
Fix AI agent governance review issues
kylewanginchina Mar 11, 2026
fa3ac8f
Fix proc scan hook warning and HTTP endpoint borrow
kylewanginchina Mar 11, 2026
d510b54
agent: auto sync AI agent gprocess_info
kylewanginchina Mar 11, 2026
27dfd38
agent: mark ai agent biz_type in gprocess
kylewanginchina Mar 11, 2026
8980494
Allow process-only refresh for unverified k8s domains and k8s process…
kylewanginchina Mar 11, 2026
480011e
server: guard executeUpdaters for process-only refresh
kylewanginchina Mar 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions agent/crates/enterprise-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,3 +436,83 @@ pub mod rpc {
}
}
}

pub mod ai_agent {
use std::sync::Arc;
use std::time::Duration;

#[derive(Debug, Clone, Default)]
pub struct AgentMeta {
pub first_seen: Duration,
pub last_seen: Duration,
pub matched_endpoint: String,
}

#[derive(Debug, Clone, Default)]
pub struct AiAgentRegistry;

impl AiAgentRegistry {
pub fn new() -> Self {
AiAgentRegistry
}

pub fn register(&self, _pid: u32, _endpoint: &str, _now: Duration) -> bool {
false
}

pub fn is_ai_agent(&self, _pid: u32) -> bool {
false
}

pub fn get_all_pids(&self) -> Vec<u32> {
vec![]
}

pub fn cleanup_dead_pids(&self, _alive_pids: &[u32]) -> Vec<u32> {
vec![]
}

pub fn len(&self) -> usize {
0
}

pub fn is_empty(&self) -> bool {
true
}

pub fn sync_bpf_map_add(&self, _pid: u32) {}

pub fn sync_bpf_map_remove(&self, _pid: u32) {}

#[cfg(target_os = "linux")]
pub fn set_bpf_map_fd(&self, _fd: i32) {}

pub fn set_file_io_enabled(&self, _enabled: bool) {}

pub fn record_endpoint_hit(&self, _pid: u32, _endpoint: &str, _now: Duration) -> bool {
false
}
}

/// Check if a URL path matches an AI Agent endpoint pattern.
pub fn match_ai_agent_endpoint(
_endpoints: &[String],
_path: &str,
_pid: u32,
_now: Duration,
) -> Option<String> {
None
}

/// Initialize the global AI Agent registry. Returns the registry Arc.
/// Stub: returns a no-op registry.
pub fn init_global_registry() -> Arc<AiAgentRegistry> {
Arc::new(AiAgentRegistry::new())
}

/// Get a reference to the global AI Agent registry.
/// Stub: always returns None.
pub fn global_registry() -> Option<&'static Arc<AiAgentRegistry>> {
None
}
}
4 changes: 4 additions & 0 deletions agent/src/common/ebpf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ pub const GO_HTTP2_UPROBE_DATA: u8 = 5;
pub const SOCKET_CLOSE_EVENT: u8 = 6;
// unix socket
pub const UNIX_SOCKET: u8 = 8;
// AI Agent governance event types
pub const FILE_OP_EVENT: u8 = 9;
pub const PERM_OP_EVENT: u8 = 10;
pub const PROC_LIFECYCLE_EVENT: u8 = 11;

const EBPF_TYPE_TRACEPOINT: u8 = 0;
const EBPF_TYPE_TLS_UPROBE: u8 = 1;
Expand Down
4 changes: 4 additions & 0 deletions agent/src/common/flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,10 @@ impl From<FlowPerfStats> for flow_log::FlowPerfStats {
}
}

// Business type constants for process classification
pub const BIZ_TYPE_DEFAULT: u8 = 0;
pub const BIZ_TYPE_AI_AGENT: u8 = 1;

#[derive(Clone, Debug, Default)]
pub struct L7Stats {
pub stats: L7PerfStats,
Expand Down
24 changes: 23 additions & 1 deletion agent/src/common/l7_protocol_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ use std::sync::{
};
use std::time::Duration;

use crate::common::l7_protocol_info::L7ProtocolInfoInterface;

use enum_dispatch::enum_dispatch;
use log::debug;
use lru::LruCache;
Expand Down Expand Up @@ -248,6 +250,16 @@ impl L7ParseResult {
L7ParseResult::None => panic!("parse result is none but unwrap multi"),
}
}

/// Check if any parsed result has the given biz_type.
/// Used to detect AI Agent flows after parsing.
pub fn has_biz_type(&self, biz_type: u8) -> bool {
match self {
L7ParseResult::Single(info) => info.get_biz_type() == biz_type,
L7ParseResult::Multi(infos) => infos.iter().any(|i| i.get_biz_type() == biz_type),
L7ParseResult::None => false,
}
}
}

#[enum_dispatch]
Expand Down Expand Up @@ -690,6 +702,8 @@ pub struct ParseParam<'a> {
pub oracle_parse_conf: OracleConfig,
pub iso8583_parse_conf: Iso8583ParseConfig,
pub web_sphere_mq_parse_conf: WebSphereMqParseConfig,

pub process_id: u32,
}

impl<'a> fmt::Debug for ParseParam<'a> {
Expand Down Expand Up @@ -793,6 +807,8 @@ impl<'a> ParseParam<'a> {
oracle_parse_conf: OracleConfig::default(),
iso8583_parse_conf: Iso8583ParseConfig::default(),
web_sphere_mq_parse_conf: WebSphereMqParseConfig::default(),

process_id: packet.process_id,
}
}
}
Expand All @@ -811,7 +827,13 @@ impl<'a> ParseParam<'a> {
}

pub fn set_buf_size(&mut self, buf_size: usize) {
self.buf_size = buf_size as u16;
// Saturate to u16::MAX to avoid overflow when AI Agent flows use larger payload sizes.
// buf_size is informational for plugins; actual payload truncation uses the usize value directly.
self.buf_size = if buf_size > u16::MAX as usize {
u16::MAX
} else {
buf_size as u16
};
}

pub fn set_captured_byte(&mut self, captured_byte: usize) {
Expand Down
Loading
Loading