pub trait AgentStore: Send + Sync {
// Required methods
fn get_agent<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Agent>, PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_agent_by_code<'life0, 'life1, 'async_trait>(
&'life0 self,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Agent>, PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_agent_by_code_and_tenant<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: Uuid,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Agent>, PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn list_agents<'life0, 'async_trait>(
&'life0 self,
tenant_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Agent>, PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_active_agents<'life0, 'async_trait>(
&'life0 self,
tenant_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Agent>, PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_agent_with_provider<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentConfig>, PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn get_agent_by_code_with_provider<'life0, 'life1, 'async_trait>(
&'life0 self,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentConfig>, PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_agent_by_code_and_tenant_with_provider<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: Uuid,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentConfig>, PersistenceError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
}Expand description
Agent 存储 trait
提供 LLM Agent 配置的数据库操作
Required Methods§
Sourcefn get_agent<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Agent>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_agent<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Agent>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
根据 ID 获取 agent
Sourcefn get_agent_by_code<'life0, 'life1, 'async_trait>(
&'life0 self,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Agent>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_agent_by_code<'life0, 'life1, 'async_trait>(
&'life0 self,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Agent>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
根据 code 获取 agent(全局查找)
Sourcefn get_agent_by_code_and_tenant<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: Uuid,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Agent>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_agent_by_code_and_tenant<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: Uuid,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<Agent>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
根据 code 和租户 ID 获取 agent
Sourcefn list_agents<'life0, 'async_trait>(
&'life0 self,
tenant_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Agent>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn list_agents<'life0, 'async_trait>(
&'life0 self,
tenant_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Agent>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
列出租户的所有 agents
Sourcefn get_active_agents<'life0, 'async_trait>(
&'life0 self,
tenant_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Agent>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_active_agents<'life0, 'async_trait>(
&'life0 self,
tenant_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Agent>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
获取租户所有启用的 agents
Sourcefn get_agent_with_provider<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentConfig>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn get_agent_with_provider<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentConfig>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
根据 ID 获取 agent 及其 provider 配置
Sourcefn get_agent_by_code_with_provider<'life0, 'life1, 'async_trait>(
&'life0 self,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentConfig>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_agent_by_code_with_provider<'life0, 'life1, 'async_trait>(
&'life0 self,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentConfig>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
根据 code 获取 agent 及其 provider 配置(全局查找)
Sourcefn get_agent_by_code_and_tenant_with_provider<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: Uuid,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentConfig>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_agent_by_code_and_tenant_with_provider<'life0, 'life1, 'async_trait>(
&'life0 self,
tenant_id: Uuid,
code: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<AgentConfig>, PersistenceError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
根据 code 和租户 ID 获取 agent 及其 provider 配置