GetAgentCard 获取 Agent Card
(agentID string)
| 55 | |
| 56 | // GetAgentCard 获取 Agent Card |
| 57 | func (s *Server) GetAgentCard(agentID string) (*AgentCard, error) { |
| 58 | // 从 Actor 系统获取 Agent |
| 59 | _, exists := s.actorSystem.GetActor(agentID) |
| 60 | if !exists { |
| 61 | return nil, fmt.Errorf("agent not found: %s", agentID) |
| 62 | } |
| 63 | |
| 64 | // 构建 Agent Card (使用静态信息) |
| 65 | // TODO: 未来可以从 Agent 的元数据中动态获取这些信息 |
| 66 | card := &AgentCard{ |
| 67 | Name: agentID, |
| 68 | Description: "Aster AI Agent: " + agentID, |
| 69 | URL: "/a2a/" + agentID, |
| 70 | Provider: Provider{ |
| 71 | Organization: "Aster", |
| 72 | URL: "https://github.com/astercloud/aster", |
| 73 | }, |
| 74 | Version: "1.0", |
| 75 | Capabilities: Capabilities{ |
| 76 | Streaming: true, |
| 77 | PushNotifications: false, |
| 78 | StateTransitionHistory: false, |
| 79 | }, |
| 80 | DefaultInputModes: []string{"text"}, |
| 81 | DefaultOutputModes: []string{"text"}, |
| 82 | Skills: []Skill{ |
| 83 | { |
| 84 | Name: "chat", |
| 85 | Description: "General conversation and assistance", |
| 86 | }, |
| 87 | }, |
| 88 | } |
| 89 | |
| 90 | return card, nil |
| 91 | } |
| 92 | |
| 93 | // handleMessageSend 处理 message/send 方法 |
| 94 | func (s *Server) handleMessageSend(ctx context.Context, agentID string, req *JSONRPCRequest) *JSONRPCResponse { |