func (m *InternalAgentsMap) FindByID(id uuid.UUID) (agent *InternalAgent, found bool) {
	agent, found = m.byID[id.String()]
	return
}
FindByID finds agent by ID
package core
import (
	"errors"
	"github.com/google/uuid"
)
var ErrAgentNameCollision = errors.New("ErrAgentNameCollision")
var ErrAgentIDCollision = errors.New("ErrAgentIDCollision")
type ExternalAgentsMap struct {
	byName map[string]*ExternalAgent
	byID   map[string]*ExternalAgent
}
func NewExternalAgentsMap() ExternalAgentsMap {
	return ExternalAgentsMap{
		byName: make(map[string]*ExternalAgent),
		byID:   make(map[string]*ExternalAgent),
	}
}
func (m *ExternalAgentsMap) Insert(a *ExternalAgent) error {
	if _, nameCollision := m.FindByName(a.Name); nameCollision {
		return ErrAgentNameCollision
	}
	if _, idCollision := m.FindByID(a.ID); idCollision {
		return ErrAgentIDCollision
	}
	m.byName[a.Name] = a
	m.byID[a.ID.String()] = a
	return nil
}
func (m *ExternalAgentsMap) FindByName(name string) (agent *ExternalAgent, found bool) {
	agent, found = m.byName[name]
	return
}
func (m *ExternalAgentsMap) FindByID(id uuid.UUID) (agent *ExternalAgent, found bool) {
	agent, found = m.byID[id.String()]
	return
}
func (m *ExternalAgentsMap) Visit(cb func(*ExternalAgent)) {
	for _, a := range m.byName {
		cb(a)
	}
}
func (m *ExternalAgentsMap) Size() int {
	return len(m.byName)
}
func (m *ExternalAgentsMap) AsArray() []*ExternalAgent {
	agents := make([]*ExternalAgent, 0, len(m.byName))
	m.Visit(func(a *ExternalAgent) {
		agents = append(agents, a)
	})
	return agents
}
func (m *ExternalAgentsMap) Clear() {
	m.byName = make(map[string]*ExternalAgent)
	m.byID = make(map[string]*ExternalAgent)
}
type InternalAgentsMap struct {
	byName map[string]*InternalAgent
	byID   map[string]*InternalAgent
}
func NewInternalAgentsMap() InternalAgentsMap {
	return InternalAgentsMap{
		byName: make(map[string]*InternalAgent),
		byID:   make(map[string]*InternalAgent),
	}
}
func (m *InternalAgentsMap) Insert(a *InternalAgent) error {
	if _, nameCollision := m.FindByName(a.Name); nameCollision {
		return ErrAgentNameCollision
	}
	if _, idCollision := m.FindByID(a.ID); idCollision {
		return ErrAgentIDCollision
	}
	m.byName[a.Name] = a
	m.byID[a.ID.String()] = a
	return nil
}
func (m *InternalAgentsMap) FindByName(name string) (agent *InternalAgent, found bool) {
	agent, found = m.byName[name]
	return
}