MCPcopy Create free account
hub / github.com/astercloud/aster / Run

Method Run

pkg/workflow/workflow_agent.go:191–210  ·  view source on GitHub ↗

Run 运行 WorkflowAgent

(ctx context.Context, input string)

Source from the content-addressed store, hash-verified

189
190// Run 运行 WorkflowAgent
191func (wa *WorkflowAgent) Run(ctx context.Context, input string) (string, error) {
192 wa.mu.RLock()
193 workflow := wa.workflow
194 wa.mu.RUnlock()
195
196 if workflow == nil {
197 return "", errors.New("no workflow attached to agent")
198 }
199
200 workflowInput := &WorkflowInput{
201 Input: input,
202 }
203
204 result, err := wa.executeWorkflow(ctx, workflowInput)
205 if err != nil {
206 return "", err
207 }
208
209 return wa.formatOutput(result), nil
210}
211
212// RunStream 流式运行 WorkflowAgent
213func (wa *WorkflowAgent) RunStream(ctx context.Context, input string) <-chan AgentStreamEvent {

Calls 2

executeWorkflowMethod · 0.95
formatOutputMethod · 0.95