ling-baseling-base

Artifact 制品

会话级版本化文件存储

在线 Playground

在浏览器中直接体验本页相关 API,无需本地安装 Go 环境。

Artifact

agentkit/artifact 管理 Agent 会话中的版本化文件(生成代码、报告、图片等),支持多版本与回滚。

Service 接口

type Service interface {
    Save(ctx context.Context, info SessionInfo, name string, data []byte) (*Artifact, error)
    Load(ctx context.Context, info SessionInfo, name string, version int) (*Artifact, error)
    List(ctx context.Context, info SessionInfo) ([]*Artifact, error)
    Delete(ctx context.Context, info SessionInfo, name string, version int) error
}

内存后端

import "github.com/LingByte/ling-base/agentkit/artifact/inmemory"

art := inmemory.NewService()
r := runner.NewRunner("app", ag, runner.WithArtifactService(art))

云存储后端

后端
artifact/s3AWS S3
artifact/cos腾讯云 COS
import "github.com/LingByte/ling-base/agentkit/artifact/s3"

art, _ := s3.New(s3.Config{
    Bucket:   "my-artifacts",
    Region:   "us-east-1",
    Prefix:   "sessions/",
})

与 stores 的区别

artifactstores
粒度会话 + 版本通用对象 key
用途Agent 产出物追踪业务文件存储
版本内置多版本需自行实现

业务用户上传用 stores;Agent 中间产物用 artifact。

On this page