MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / createAgent

Function createAgent

internal/identity/store.go:937–958  ·  view source on GitHub ↗
(ctx context.Context, exec agentExecutor, agentEmail, domain, name, userID string)

Source from the content-addressed store, hash-verified

935}
936
937func createAgent(ctx context.Context, exec agentExecutor, agentEmail, domain, name, userID string) (*AgentIdentity, error) {
938 a := &AgentIdentity{
939 ID: agentEmail,
940 Domain: normalizeDomain(domain),
941 Name: name,
942 Public: true,
943 CreatedAt: time.Now(),
944 UserID: userID,
945 HITLTTLSeconds: HITLDefaultTTLSeconds,
946 HITLExpirationAction: HITLDefaultExpirationAct,
947 }
948 _, err := exec.Exec(ctx,
949 `INSERT INTO agent_identities (id, domain, user_id, name, public, created_at)
950 VALUES ($1, $2, $3, $4, $5, $6)`,
951 a.ID, a.Domain, a.UserID, a.Name, a.Public, a.CreatedAt,
952 )
953 if err != nil {
954 return nil, err
955 }
956 a.populateEmail()
957 return a, nil
958}
959
960// UpdateAgentHITL updates all three HITL settings on an agent owned by userID.
961// The TTL and expiration action are validated against the same rules as the

Callers 2

CreateAgentMethod · 0.70
CreateAgentTxMethod · 0.70

Calls 3

populateEmailMethod · 0.95
normalizeDomainFunction · 0.85
ExecMethod · 0.65

Tested by

no test coverage detected