Documentation
¶
Overview ¶
Package agentx 提供 AgentX 的最小公共执行合同。
当前 Developer Preview 定义 Client、Run、错误、执行画像和 ExecutionAdapter 扩展接缝,但不包含 Runtime 构造、模型/provider、Workflow、 Objective、Resume、持久化生命周期、HTTP 或 Scene 能力。
本包进入首版9包核心兼容候选面,但不是 Beta、Stable 或生产 SLA。
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdapterRunRequest ¶
AdapterRunRequest 是传递给 ExecutionAdapter 的底层无关输入。
type AdapterRunResult ¶
AdapterRunResult 是 ExecutionAdapter 返回的底层无关结果。
Status 是 adapter 对底层执行状态的观察;Client 会将其映射为稳定的公共状态、 blocker 和 next action。
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 是 ExecutionAdapter 之上的薄公共合同。
Client 方法可并发调用,但同一 Client 的重叠 Run 会被串行化。Shutdown 可与 当前 Run 并发;Shutdown 一旦开始,新的 Run 会返回 CodeClientClosed。
type Config ¶
type Config struct {
Adapter ExecutionAdapter
Profile ExecutionProfile
}
Config 绑定一个由 host 构造的底层无关 ExecutionAdapter。
New 成功后,调用方将 Adapter 的 Run 和 Shutdown 独占访问权交给 Client,不应 再直接调用该 Adapter。
type Error ¶
type Error struct {
Code ErrorCode
Retryable bool
Message string
// contains filtered or unexported fields
}
Error 是 Client 返回的 display-safe typed error。
Message 不包含 adapter/backend 原始错误;Unwrap 仍保留 cause,供 errors.Is/errors.As 进行程序化判断。
type ErrorCode ¶
type ErrorCode string
ErrorCode 是稳定、可供程序判断的错误类别。
const ( CodeInvalidArgument ErrorCode = "invalid_argument" CodeCanceled ErrorCode = "canceled" CodeDeadlineExceeded ErrorCode = "deadline_exceeded" CodeClientClosed ErrorCode = "client_closed" CodeUnsupportedProfile ErrorCode = "unsupported_profile" CodeExecutionFailed ErrorCode = "execution_failed" CodeShutdownFailed ErrorCode = "shutdown_failed" )
type ExecutionAdapter ¶
type ExecutionAdapter interface {
Run(context.Context, AdapterRunRequest) (*AdapterRunResult, error)
Shutdown(context.Context) error
ClassifyError(error) ErrorCode
}
ExecutionAdapter 是 Client 使用的最窄执行接缝。
Client 会串行调用 Run;Shutdown 可以与 Run 并发,以便实现取消和收敛正在 执行的工作。实现必须让 Shutdown 支持重复调用,并自行持有底层 Runtime 的构造、 状态、结果提取和错误分类语义。
type ExecutionProfile ¶
type ExecutionProfile struct {
Activation string
ControlMode string
ExecutionIntensity string
Driver string
ResultPolicy string
Lifecycle string
}
ExecutionProfile 描述一次执行的六个正交维度。
当前根 Client 只接受 DefaultExecutionProfile 返回的同步 open-tool-loop 画像。 这些字符串是可观测合同,不表示调用方可任意组合底层 Runtime 能力。
func DefaultExecutionProfile ¶
func DefaultExecutionProfile() ExecutionProfile
DefaultExecutionProfile 返回根 Client 当前唯一支持的执行画像。
Config.Profile 的零值等价于该画像。需要 Workflow、Objective、Resume 或长任务 组合的调用方应使用对应 Runtime Host Kit,不应修改这些字段来伪装启用能力。
Directories
¶
| Path | Synopsis |
|---|---|
|
browser
module
|
|
|
components
module
|
|
|
document
module
|
|
|
extensions
module
|
|
|
providers
module
|
|
|
runtime
module
|
|
|
scenes
module
|
|
|
tools
module
|