Files
Genarrative/server-rs/crates/platform-agent-harness/src/agent_builder.rs
T
kdletters d7f0c45164
Project CI / Repository checks (push) Successful in 1m3s
Project CI / Frontend tests (push) Successful in 1m59s
Project CI / Native shell tests (push) Successful in 2m27s
Project CI / Backend tests (push) Successful in 3m5s
抽取画布 Agent 公共执行框架
新增业务中立的 function-calling harness 与公共提示词协议

统一画布 Agent 工具路由约束和待确认控制语义

保留失败前输出并事务化收口 memory、deadline 与取消状态

迁移画布 Agent 和 API 编排并同步架构文档与项目记忆
2026-07-28 21:34:34 +08:00

19 lines
634 B
Rust

use crate::agent::{Agent, LlmApiAdaptor};
use crate::hook::Hook;
use crate::memory::AgentMemory;
use crate::tool::Tool;
pub trait AgentBuilder<Message, M: LlmApiAdaptor<Message>> {
type Client;
fn new() -> Self;
fn with_client(self, client: Self::Client) -> Self;
fn system_prompt(self, system_prompt: impl Into<String>) -> Self;
fn tool(self, tool: impl Tool + Send + Sync + 'static) -> Self;
fn add_hook(self, hook: impl Hook + 'static) -> Self;
fn max_turns(self, n: usize) -> Self;
fn memory(self, memory: impl AgentMemory<Message> + 'static) -> Self;
fn build(self) -> Agent<M, Message>;
}