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

Function AgentActorCallTool

pkg/agent/actor.go:555–571  ·  view source on GitHub ↗

AgentActorCallTool 向 Agent Actor 发送工具调用请求并等待响应

(pid *actor.PID, toolName string, input map[string]any, timeout time.Duration)

Source from the content-addressed store, hash-verified

553
554// AgentActorCallTool 向 Agent Actor 发送工具调用请求并等待响应
555func AgentActorCallTool(pid *actor.PID, toolName string, input map[string]any, timeout time.Duration) (*DirectToolResultMsg, error) {
556 replyCh := make(chan *DirectToolResultMsg, 1)
557
558 pid.Tell(&DirectToolCallMsg{
559 ToolName: toolName,
560 Input: input,
561 Ctx: context.Background(),
562 ReplyTo: replyCh,
563 })
564
565 select {
566 case result := <-replyCh:
567 return result, nil
568 case <-time.After(timeout):
569 return nil, fmt.Errorf("tool call timed out after %v", timeout)
570 }
571}
572
573// AgentActorGetStatus 获取 Agent 状态
574func AgentActorGetStatus(pid *actor.PID, timeout time.Duration) (*types.AgentStatus, error) {

Callers

nothing calls this directly

Calls 1

TellMethod · 0.80

Tested by

no test coverage detected