agents
Package github.com/emergent-company/emergent.memory/apps/server/pkg/sdk/agents
The agents client manages AI agents — their lifecycle, runs, webhook hooks, question-answer interactions, and ADK sessions.
Methods
Section titled “Methods”Agent CRUD
Section titled “Agent CRUD”func (c *Client) List(ctx context.Context) (*APIResponse[[]Agent], error)func (c *Client) Get(ctx context.Context, agentID string) (*APIResponse[Agent], error)func (c *Client) Create(ctx context.Context, req *CreateAgentRequest) (*APIResponse[Agent], error)func (c *Client) Update(ctx context.Context, agentID string, req *UpdateAgentRequest) (*APIResponse[Agent], error)func (c *Client) Delete(ctx context.Context, agentID string) errorTriggering
Section titled “Triggering”func (c *Client) Trigger(ctx context.Context, agentID string) (*TriggerResponse, error)func (c *Client) BatchTrigger(ctx context.Context, agentID string, req *BatchTriggerRequest) (*APIResponse[BatchTriggerResponse], error)func (c *Client) GetPendingEvents(ctx context.Context, agentID string, limit int) (*APIResponse[PendingEventsResponse], error)func (c *Client) GetRuns(ctx context.Context, agentID string, limit int) (*APIResponse[[]AgentRun], error)func (c *Client) ListProjectRuns(ctx context.Context, projectID string, opts *ListRunsOptions) (*APIResponse[PaginatedResponse[AgentRun]], error)func (c *Client) GetProjectRun(ctx context.Context, projectID, runID string) (*APIResponse[AgentRun], error)func (c *Client) CancelRun(ctx context.Context, agentID, runID string) errorfunc (c *Client) GetRunMessages(ctx context.Context, projectID, runID string) (*APIResponse[[]AgentRunMessage], error)func (c *Client) GetRunToolCalls(ctx context.Context, projectID, runID string) (*APIResponse[[]AgentRunToolCall], error)Questions
Section titled “Questions”func (c *Client) GetRunQuestions(ctx context.Context, projectID, runID string) (*APIResponse[[]AgentQuestion], error)func (c *Client) ListProjectQuestions(ctx context.Context, projectID, status string) (*APIResponse[[]AgentQuestion], error)func (c *Client) RespondToQuestion(ctx context.Context, projectID, questionID string, req *RespondToQuestionRequest) (*APIResponse[AgentQuestion], error)Webhook Hooks
Section titled “Webhook Hooks”func (c *Client) CreateWebhookHook(ctx context.Context, agentID string, req *CreateWebhookHookRequest) (*APIResponse[WebhookHook], error)func (c *Client) ListWebhookHooks(ctx context.Context, agentID string) (*APIResponse[[]WebhookHook], error)func (c *Client) DeleteWebhookHook(ctx context.Context, agentID, hookID string) errorADK Sessions
Section titled “ADK Sessions”func (c *Client) ListADKSessions(ctx context.Context, projectID string) ([]*ADKSession, error)func (c *Client) GetADKSession(ctx context.Context, projectID, sessionID string) (*ADKSession, error)Key Types
Section titled “Key Types”type Agent struct { ID string ProjectID string Name string StrategyType string Prompt *string CronSchedule string Enabled bool TriggerType string ReactionConfig *ReactionConfig ExecutionMode string Capabilities *AgentCapabilities Config map[string]any Description *string LastRunAt *time.Time LastRunStatus *string CreatedAt time.Time UpdatedAt time.Time}ReactionConfig
Section titled “ReactionConfig”type ReactionConfig struct { ObjectTypes []string Events []string ConcurrencyStrategy string IgnoreAgentTriggered *bool IgnoreSelfTriggered *bool}AgentCapabilities
Section titled “AgentCapabilities”type AgentCapabilities struct { CanCreateObjects *bool CanUpdateObjects *bool CanDeleteObjects *bool CanCreateRelationships *bool AllowedObjectTypes []string}CreateAgentRequest
Section titled “CreateAgentRequest”type CreateAgentRequest struct { ProjectID string Name string StrategyType string Prompt *string CronSchedule string Enabled *bool TriggerType string ReactionConfig *ReactionConfig ExecutionMode string Capabilities *AgentCapabilities Config map[string]any Description *string}UpdateAgentRequest
Section titled “UpdateAgentRequest”All fields are optional (pointer or omitempty).
type UpdateAgentRequest struct { Name *string Prompt *string Enabled *bool CronSchedule *string TriggerType *string ReactionConfig *ReactionConfig ExecutionMode *string Capabilities *AgentCapabilities Config map[string]any Description *string}AgentRun
Section titled “AgentRun”type AgentRun struct { ID string AgentID string Status string // "pending", "running", "completed", "failed", "cancelled" StartedAt time.Time CompletedAt *time.Time DurationMs *int Summary map[string]any ErrorMessage *string SkipReason *string StepCount int MaxSteps *int ParentRunID *string ResumedFrom *string TriggerSource *string TriggerMetadata map[string]any}AgentRunMessage
Section titled “AgentRunMessage”type AgentRunMessage struct { ID string RunID string Role string Content map[string]any StepNumber int CreatedAt time.Time}AgentRunToolCall
Section titled “AgentRunToolCall”type AgentRunToolCall struct { ID string RunID string MessageID *string ToolName string Input map[string]any Output map[string]any Status string DurationMs *int StepNumber int CreatedAt time.Time}AgentQuestion
Section titled “AgentQuestion”type AgentQuestion struct { ID string RunID string AgentID string ProjectID string Question string Options []AgentQuestionOption Response *string RespondedBy *string RespondedAt *time.Time Status string NotificationID *string CreatedAt time.Time UpdatedAt time.Time}
type AgentQuestionOption struct { Label string Value string Description string}
type RespondToQuestionRequest struct { Response string}ListRunsOptions
Section titled “ListRunsOptions”type ListRunsOptions struct { Limit int Offset int AgentID string Status string}Trigger / Batch Types
Section titled “Trigger / Batch Types”type TriggerResponse struct { Success bool RunID *string Message *string Error *string}
type BatchTriggerRequest struct { ObjectIDs []string}
type BatchTriggerResponse struct { Queued int Skipped int SkippedDetails []struct { ObjectID string Reason string }}WebhookHook
Section titled “WebhookHook”type WebhookHook struct { ID string AgentID string ProjectID string Label string Enabled bool RateLimitConfig *RateLimitConfig CreatedAt time.Time UpdatedAt time.Time Token *string // Only present on creation}
type RateLimitConfig struct { RequestsPerMinute int BurstSize int}
type CreateWebhookHookRequest struct { Label string RateLimitConfig *RateLimitConfig}APIResponse
Section titled “APIResponse”type APIResponse[T any] struct { Success bool Data T Error *string Message *string}
type PaginatedResponse[T any] struct { Items []T TotalCount int Limit int Offset int}Examples
Section titled “Examples”// Create a scheduled agentresp, err := client.Agents.Create(ctx, &agents.CreateAgentRequest{ Name: "Daily Summarizer", StrategyType: "adk", CronSchedule: "0 9 * * *", TriggerType: "schedule", Enabled: boolPtr(true),})fmt.Printf("Created: %s\n", resp.Data.ID)
// Trigger an agent manuallytrigger, err := client.Agents.Trigger(ctx, agentID)fmt.Printf("Run ID: %s\n", *trigger.RunID)
// Cancel a runerr = client.Agents.CancelRun(ctx, agentID, runID)
// List all runs with filterruns, err := client.Agents.ListProjectRuns(ctx, projectID, &agents.ListRunsOptions{ Status: "failed", Limit: 50,})for _, run := range runs.Data.Items { fmt.Printf("Run %s failed: %v\n", run.ID, run.ErrorMessage)}
// Respond to a pending question_, err = client.Agents.RespondToQuestion(ctx, projectID, questionID, &agents.RespondToQuestionRequest{Response: "yes"})
// Create a webhook hookhook, err := client.Agents.CreateWebhookHook(ctx, agentID, &agents.CreateWebhookHookRequest{ Label: "My Webhook", RateLimitConfig: &agents.RateLimitConfig{ RequestsPerMinute: 60, BurstSize: 10, },})fmt.Printf("Token (save this): %s\n", *hook.Data.Token)