企业协作 Agent 设计:会议纪要、任务分配和进度跟进的自动化

一、每周开 5 个会,4 个都在确认"上次说的那件事做了没"

企业协作最耗时的不是"干活",而是"同步信息"。一个 10 人团队,每周花费在"任务进度对齐""会议纪要整理""跨部门信息同步"上的时间保守估计在 20-30 人时。更讽刺的是,这些活动本身不产生任何直接产出。企业协作 Agent 的目标不是取代人的决策,而是接管"信息搬运"这类重复劳动。

设计企业协作 Agent 面临三个核心挑战:信息源分散(IM 聊天记录、邮件、项目管理工具各有一套数据)、上下文理解难("那个需求"指的是哪个需求?需要回溯对话历史)、以及自动化边界模糊(Agent 能自动分配任务吗?还是只能提醒?)。这些决定了架构必须在"智能"和"可控"之间找到平衡。

二、协作 Agent 的多源信息融合架构

核心设计是"感知-理解-行动"三层结构:

这个架构的关键是"意图理解层"——不能简单地把聊天记录扔给 LLM,要先用规则和 NER 模型做结构化抽取,再用 LLM 做语义理解和推理。分两步走可以大幅降低幻觉率。

三、Go 实现:协作 Agent 核心编排

package collab

import (
    "context"
    "fmt"
    "strings"
    "regexp"
    "time"
)

// MessageSource 消息来源
type MessageSource string

const (
    SourceIM      MessageSource = "im"
    SourceEmail   MessageSource = "email"
    SourceProject MessageSource = "project"
    SourceCalendar MessageSource = "calendar"
)

// RawEvent 原始事件(来自各信息源)
type RawEvent struct {
    Source    MessageSource `json:"source"`
    Content   string        `json:"content"`
    Sender    string        `json:"sender"`
    Channel   string        `json:"channel"`    // 群聊ID/项目ID
    Timestamp time.Time     `json:"timestamp"`
    EventID   string        `json:"event_id"`
}

// IntentType 意图类型
type IntentType string

const (
    IntentMeeting   IntentType = "meeting"   // 会议相关
    IntentTask      IntentType = "task"      // 任务相关
    IntentDecision  IntentType = "decision"  // 决策相关
    IntentQuestion  IntentType = "question"  // 提问相关
    IntentOther     IntentType = "other"     // 其他
)

// ParsedIntent 解析后的意图
type ParsedIntent struct {
    Type      IntentType     `json:"type"`
    Confidence float64       `json:"confidence"` // 0-1
    Entities  IntentEntities `json:"entities"`
}

// IntentEntities 意图实体
type IntentEntities struct {
    Participants []string  `json:"participants,omitempty"`
    Deadline     *time.Time `json:"deadline,omitempty"`
    Subject      string    `json:"subject,omitempty"`
    ActionItems  []string  `json:"action_items,omitempty"`
}

// Action 可执行动作
type Action struct {
    Type        string    `json:"type"`        // create_meeting_note, create_task, send_reminder
    Description string    `json:"description"`
    Parameters  map[string]interface{} `json:"parameters"`
    AutoExecute bool      `json:"auto_execute"` // 是否自动执行
    Confidence  float64   `json:"confidence"`
}

// CollaborationAgent 企业协作 Agent
type CollaborationAgent struct {
    intentParser  IntentParser
    actionPlanner ActionPlanner
}

// IntentParser 意图解析器接口
type IntentParser interface {
    Parse(ctx context.Context, event *RawEvent) (*ParsedIntent, error)
}

// ActionPlanner 动作规划器接口
type ActionPlanner interface {
    Plan(ctx context.Context, intent *ParsedIntent, event *RawEvent) ([]*Action, error)
}

// NewCollaborationAgent 创建协作 Agent
func NewCollaborationAgent(parser IntentParser, planner ActionPlanner) *CollaborationAgent {
    return &CollaborationAgent{
        intentParser:  parser,
        actionPlanner: planner,
    }
}

// Process 处理原始事件的主流程
func (ca *CollaborationAgent) Process(
    ctx context.Context, event *RawEvent,
) ([]*Action, error) {
    // 1. 去重:检查是否已处理过相同事件
    if ca.isDuplicate(event) {
        return nil, fmt.Errorf("事件重复: %s", event.EventID)
    }

    // 2. 意图解析
    intent, err := ca.intentParser.Parse(ctx, event)
    if err != nil {
        return nil, fmt.Errorf("意图解析失败: %w", err)
    }
    if intent.Type == IntentOther || intent.Confidence < 0.6 {
        // 低置信度的意图不自动处理
        return nil, nil
    }

    // 3. 动作规划
    actions, err := ca.actionPlanner.Plan(ctx, intent, event)
    if err != nil {
        return nil, fmt.Errorf("动作规划失败: %w", err)
    }

    // 4. 置信度过滤
    var executable []*Action
    for _, action := range actions {
        if action.AutoExecute && action.Confidence >= 0.8 {
            executable = append(executable, action)
        } else if action.Confidence >= 0.6 {
            // 低置信度动作标记为待确认
            action.AutoExecute = false
            executable = append(executable, action)
        }
    }

    return executable, nil
}

func (ca *CollaborationAgent) isDuplicate(event *RawEvent) bool {
    // 实际项目通过 Redis 的去重 key 实现
    return false
}

// RuleBasedIntentParser 基于规则的意图解析器(替代 LLM 的基础场景)
type RuleBasedIntentParser struct {
    meetingKeywords  []*regexp.Regexp
    taskKeywords     []*regexp.Regexp
    decisionKeywords []*regexp.Regexp
    deadlinePattern  *regexp.Regexp
    mentionPattern   *regexp.Regexp
}

// NewRuleBasedParser 创建规则解析器
func NewRuleBasedParser() *RuleBasedIntentParser {
    return &RuleBasedIntentParser{
        meetingKeywords: []*regexp.Regexp{
            regexp.MustCompile(`(开会|会议|讨论|周会|站会|评审|同步)`),
            regexp.MustCompile(`(明天|下周|今天|下午)\s*(几点|什么时间|有空)`),
        },
        taskKeywords: []*regexp.Regexp{
            regexp.MustCompile(`(做一下|处理|负责|跟进|修复|实现)`),
            regexp.MustCompile(`(DDL|截止|deadline|这周|本周内)`),
        },
        decisionKeywords: []*regexp.Regexp{
            regexp.MustCompile(`(决定了|确定了|定了|最终方案|结论是)`),
        },
        deadlinePattern: regexp.MustCompile(
            `(\d{4}[-/]\d{1,2}[-/]\d{1,2})|(周[一二三四五六日])|(明天|后天|下周)`,
        ),
        mentionPattern: regexp.MustCompile(`@(\w+)`),
    }
}

// Parse 解析意图
func (p *RuleBasedIntentParser) Parse(
    ctx context.Context, event *RawEvent,
) (*ParsedIntent, error) {
    text := event.Content
    intent := &ParsedIntent{
        Type:   IntentOther,
        Confidence: 0.3,
    }

    // 会议意图匹配
    for _, pattern := range p.meetingKeywords {
        if pattern.MatchString(text) {
            intent.Type = IntentMeeting
            intent.Confidence = 0.75
            break
        }
    }
    // 任务意图匹配
    for _, pattern := range p.taskKeywords {
        if pattern.MatchString(text) {
            intent.Type = IntentTask
            intent.Confidence = 0.7
            break
        }
    }
    // 决策意图匹配
    for _, pattern := range p.decisionKeywords {
        if pattern.MatchString(text) {
            intent.Type = IntentDecision
            intent.Confidence = 0.8
            break
        }
    }

    // 提取实体
    mentions := p.mentionPattern.FindAllStringSubmatch(text, -1)
    for _, m := range mentions {
        if len(m) > 1 {
            intent.Entities.Participants = append(
                intent.Entities.Participants, m[1],
            )
        }
    }

    // 提取截止时间
    deadlineMatch := p.deadlinePattern.FindString(text)
    if deadlineMatch != "" {
        deadline := time.Now().Add(24 * time.Hour) // 简化:默认明天
        intent.Entities.Deadline = &deadline
    }

    // 提取主题(第一句话)
    sentences := strings.Split(text, "。")
    if len(sentences) > 0 {
        intent.Entities.Subject = strings.TrimSpace(sentences[0])
    }

    return intent, nil
}

// Plan 根据意图生成动作
func (p *RuleBasedIntentParser) Plan(
    ctx context.Context,
    intent *ParsedIntent,
    event *RawEvent,
) ([]*Action, error) {
    var actions []*Action

    switch intent.Type {
    case IntentMeeting:
        actions = append(actions, &Action{
            Type:        "create_meeting_note",
            Description: fmt.Sprintf("创建会议纪要: %s", intent.Entities.Subject),
            Parameters: map[string]interface{}{
                "subject":      intent.Entities.Subject,
                "participants": intent.Entities.Participants,
                "source":       event.Channel,
                "timestamp":    event.Timestamp,
            },
            AutoExecute: true,
            Confidence:  0.85,
        })
    case IntentTask:
        if intent.Entities.Deadline != nil {
            actions = append(actions, &Action{
                Type:        "create_task",
                Description: fmt.Sprintf("创建任务: %s", intent.Entities.Subject),
                Parameters: map[string]interface{}{
                    "title":    intent.Entities.Subject,
                    "assignee": intent.Entities.Participants,
                    "deadline": intent.Entities.Deadline,
                    "source":   event.Content,
                },
                AutoExecute: false, // 任务创建需要人工确认
                Confidence:  0.7,
            })
        }
    }

    return actions, nil
}

四、边界分析与 Trade-offs

自动化程度的控制:有些动作可以全自动(如生成会议纪要和待办列表),有些必须人工确认(如直接分配任务给某人)。这个"自动化程度"的判断比技术实现本身更难。一个实用判断标准:如果出错会导致团队内部误解 ≥ 30 分钟,就需要人工确认。

信息过载 vs 信息遗漏:Agent 如果对每条消息都触发动作,团队会被提醒淹死。需要引入"上下文重要性"打分——只对包含 @提及、关键词命中、或由管理者发送的消息做处理。普通闲聊不计入。

跨平台数据一致性:一条任务在飞书群里"口头"分配了,但没同步到 Jira——这是企业协作最常见的信息断裂。Agent 的价值就是做这个"数据的自动搬运"。但需要处理冲突:Jira 里已经有一个类似任务时,是合并还是去重?建议默认去重(相似度 > 80% 时提醒用户,不作为新任务创建)。

隐私边界敏感度:企业聊天记录里可能包含薪资、人事变动等敏感信息。Agent 的消息采集必须做"频道白名单",只监听公开项目群和指定讨论组,不监听一对一私聊和 HR 群。

五、总结

企业协作 Agent 的核心价值是"信息搬运自动化"——把聊天记录里的决议变成会议纪要,把口头分配的任务变成 Jira Ticket,把零散的消息变成结构化的周报。技术实现上,意图识别要多路协同(规则 + NER + LLM),按置信度分级自动化处理。工程上最容易被忽略的是"去重"和"冲突处理"——信息源有天然冗余,Agent 需要能识别"同一条任务在三个群里被讨论"而不是创建三个重复 Ticket。

Logo

小龙虾开发者社区是 CSDN 旗下专注 OpenClaw 生态的官方阵地,聚焦技能开发、插件实践与部署教程,为开发者提供可直接落地的方案、工具与交流平台,助力高效构建与落地 AI 应用

更多推荐