QueryAgent 查询 Agent 状态
(agentID string)
| 162 | |
| 163 | // QueryAgent 查询 Agent 状态 |
| 164 | func (i *A2AInterface) QueryAgent(agentID string) (map[string]any, error) { |
| 165 | i.mu.RLock() |
| 166 | defer i.mu.RUnlock() |
| 167 | |
| 168 | ag, exists := i.agents[agentID] |
| 169 | if !exists { |
| 170 | return nil, fmt.Errorf("agent not found: %s", agentID) |
| 171 | } |
| 172 | |
| 173 | status := ag.Status() |
| 174 | |
| 175 | return map[string]any{ |
| 176 | "agent_id": status.AgentID, |
| 177 | "state": status.State, |
| 178 | }, nil |
| 179 | } |
| 180 | |
| 181 | // ListAgents 列出所有可用的 Agents |
| 182 | func (i *A2AInterface) ListAgents() []string { |