Documentation
¶
Index ¶
- func EndpointFromEnv() (string, error)
- func NewClientFromEnv() (*Client, *Config, error)
- type Client
- func (c *Client) ApplySchedule(ctx context.Context, id string, data []byte) (json.RawMessage, error)
- func (c *Client) ApplySlackBot(ctx context.Context, id string, data []byte) (json.RawMessage, error)
- func (c *Client) ApplyWebhook(ctx context.Context, id string, data []byte) (json.RawMessage, error)
- func (c *Client) CreateMemory(ctx context.Context, req *CreateMemoryRequest) (*MemoryEntry, error)
- func (c *Client) CreateSchedule(ctx context.Context, data []byte) (json.RawMessage, error)
- func (c *Client) CreateSlackBot(ctx context.Context, data []byte) (json.RawMessage, error)
- func (c *Client) CreateTask(ctx context.Context, sessionID string, req *CreateTaskRequest) (*TaskResponse, error)
- func (c *Client) CreateWebhook(ctx context.Context, data []byte) (json.RawMessage, error)
- func (c *Client) DeleteMemory(ctx context.Context, id string) error
- func (c *Client) DeleteSchedule(ctx context.Context, id string) error
- func (c *Client) DeleteSession(ctx context.Context, sessionID string) (*DeleteResponse, error)
- func (c *Client) DeleteSlackBot(ctx context.Context, id string) error
- func (c *Client) DeleteTask(ctx context.Context, taskID string) error
- func (c *Client) DeleteWebhook(ctx context.Context, id string) error
- func (c *Client) GetMemory(ctx context.Context, id string) (*MemoryEntry, error)
- func (c *Client) GetMessages(ctx context.Context, sessionID string) (*MessagesResponse, error)
- func (c *Client) GetSchedule(ctx context.Context, id string) (json.RawMessage, error)
- func (c *Client) GetSlackBot(ctx context.Context, id string) (json.RawMessage, error)
- func (c *Client) GetStatus(ctx context.Context, sessionID string) (*StatusResponse, error)
- func (c *Client) GetTask(ctx context.Context, taskID string) (*TaskResponse, error)
- func (c *Client) GetWebhook(ctx context.Context, id string) (json.RawMessage, error)
- func (c *Client) ListMemories(ctx context.Context, scope, teamID string, tags map[string]string, ...) (*MemoryListResponse, error)
- func (c *Client) ListMemoriesUnion(ctx context.Context, scope, teamID string, tags map[string]string) (*MemoryListResponse, error)
- func (c *Client) ListSchedules(ctx context.Context, opts *ListSchedulesOptions) (json.RawMessage, error)
- func (c *Client) ListSlackBots(ctx context.Context, opts *ListSlackBotsOptions) (json.RawMessage, error)
- func (c *Client) ListTasks(ctx context.Context, opts *ListTasksOptions) (*TaskListResponse, error)
- func (c *Client) ListWebhooks(ctx context.Context, opts *ListWebhooksOptions) (json.RawMessage, error)
- func (c *Client) RegenerateWebhookSecret(ctx context.Context, id string) (json.RawMessage, error)
- func (c *Client) Search(ctx context.Context, status string) (*SearchResponse, error)
- func (c *Client) SearchWithTags(ctx context.Context, status string, tags map[string]string) (*SearchResponse, error)
- func (c *Client) SendMessage(ctx context.Context, sessionID string, message *Message) (*MessageResponse, error)
- func (c *Client) SendNotification(ctx context.Context, req *SendNotificationRequest) (*SendNotificationResponse, error)
- func (c *Client) Start(ctx context.Context, req *StartRequest) (*StartResponse, error)
- func (c *Client) StreamEvents(ctx context.Context, sessionID string) (<-chan string, <-chan error)
- func (c *Client) UpdateMemory(ctx context.Context, id string, req *UpdateMemoryRequest) (*MemoryEntry, error)
- func (c *Client) UpdateTask(ctx context.Context, taskID string, req *UpdateTaskRequest) (*TaskResponse, error)
- func (c *Client) UpsertMemory(ctx context.Context, scope, teamID, title, content string, ...) (*MemoryEntry, error)
- type ClientOption
- type Config
- type CreateMemoryRequest
- type CreateTaskRequest
- type DeleteResponse
- type HTTPClient
- type ListSchedulesOptions
- type ListSlackBotsOptions
- type ListTasksOptions
- type ListWebhooksOptions
- type MemoryEntry
- type MemoryListResponse
- type Message
- type MessageResponse
- type MessagesResponse
- type RequestMiddleware
- type SearchResponse
- type SendNotificationRequest
- type SendNotificationResponse
- type SessionInfo
- type StartParams
- type StartRequest
- type StartResponse
- type StatusResponse
- type TaskLink
- type TaskListResponse
- type TaskResponse
- type UpdateMemoryRequest
- type UpdateTaskRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EndpointFromEnv ¶ added in v1.253.0
EndpointFromEnv builds the endpoint URL from environment variables. It reads AGENTAPI_PROXY_SERVICE_HOST and AGENTAPI_PROXY_SERVICE_PORT_HTTP.
func NewClientFromEnv ¶ added in v1.229.0
NewClientFromEnv creates a new client from environment variables
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an agentapi-proxy client
func NewClient ¶
func NewClient(baseURL string, opts ...ClientOption) *Client
NewClient creates a new agentapi-proxy client with options
func (*Client) ApplySchedule ¶ added in v1.343.0
func (c *Client) ApplySchedule(ctx context.Context, id string, data []byte) (json.RawMessage, error)
ApplySchedule partially updates a schedule by sending the given JSON as a PUT request. Only fields present in the JSON body are updated (merge-patch semantics).
func (*Client) ApplySlackBot ¶ added in v1.343.0
func (c *Client) ApplySlackBot(ctx context.Context, id string, data []byte) (json.RawMessage, error)
ApplySlackBot partially updates a SlackBot by sending the given JSON as a PUT request. Only fields present in the JSON body are updated (merge-patch semantics).
func (*Client) ApplyWebhook ¶ added in v1.343.0
ApplyWebhook partially updates a webhook by sending the given JSON as a PUT request. Only fields present in the JSON body are updated (merge-patch semantics).
func (*Client) CreateMemory ¶ added in v1.295.0
func (c *Client) CreateMemory(ctx context.Context, req *CreateMemoryRequest) (*MemoryEntry, error)
CreateMemory creates a new memory entry
func (*Client) CreateSchedule ¶ added in v1.343.0
CreateSchedule creates a new schedule from the given JSON body and returns the raw JSON response.
func (*Client) CreateSlackBot ¶ added in v1.343.0
CreateSlackBot creates a new SlackBot from the given JSON body and returns the raw JSON response.
func (*Client) CreateTask ¶ added in v1.249.0
func (c *Client) CreateTask(ctx context.Context, sessionID string, req *CreateTaskRequest) (*TaskResponse, error)
CreateTask creates a new task associated with the given session. sessionID is required and will be embedded in the request body.
func (*Client) CreateWebhook ¶ added in v1.343.0
CreateWebhook creates a new webhook from the given JSON body and returns the raw JSON response.
func (*Client) DeleteMemory ¶ added in v1.295.0
DeleteMemory deletes a memory entry by ID
func (*Client) DeleteSchedule ¶ added in v1.343.0
DeleteSchedule deletes a schedule by ID.
func (*Client) DeleteSession ¶ added in v0.11.0
DeleteSession terminates and deletes a session
func (*Client) DeleteSlackBot ¶ added in v1.343.0
DeleteSlackBot deletes a SlackBot by ID.
func (*Client) DeleteTask ¶ added in v1.249.0
DeleteTask deletes a task by its ID
func (*Client) DeleteWebhook ¶ added in v1.343.0
DeleteWebhook deletes a webhook by ID.
func (*Client) GetMessages ¶
GetMessages retrieves conversation history from an agentapi session
func (*Client) GetSchedule ¶ added in v1.343.0
GetSchedule retrieves a schedule by ID and returns the raw JSON response.
func (*Client) GetSlackBot ¶ added in v1.343.0
GetSlackBot retrieves a SlackBot by ID and returns the raw JSON response.
func (*Client) GetWebhook ¶ added in v1.343.0
GetWebhook retrieves a webhook by ID and returns the raw JSON response.
func (*Client) ListMemories ¶ added in v1.295.0
func (c *Client) ListMemories(ctx context.Context, scope, teamID string, tags map[string]string, excludeTags map[string]string) (*MemoryListResponse, error)
ListMemories lists memory entries with optional filters. scope: "user" or "team". teamID: required when scope="team". tags: AND-combined tag filter map. excludeTags: memories matching ALL of these tags are excluded (nil = no exclusion).
func (*Client) ListMemoriesUnion ¶ added in v1.311.0
func (c *Client) ListMemoriesUnion(ctx context.Context, scope, teamID string, tags map[string]string) (*MemoryListResponse, error)
ListMemoriesUnion returns the union of memories matching any of the given tags (OR logic). For each tag key-value pair, a separate API call is made and results are deduplicated by ID. If tags is empty or contains a single entry, behaves identically to ListMemories.
func (*Client) ListSchedules ¶ added in v1.343.0
func (c *Client) ListSchedules(ctx context.Context, opts *ListSchedulesOptions) (json.RawMessage, error)
ListSchedules lists schedules and returns the raw JSON response.
func (*Client) ListSlackBots ¶ added in v1.343.0
func (c *Client) ListSlackBots(ctx context.Context, opts *ListSlackBotsOptions) (json.RawMessage, error)
ListSlackBots lists SlackBots and returns the raw JSON response.
func (*Client) ListTasks ¶ added in v1.249.0
func (c *Client) ListTasks(ctx context.Context, opts *ListTasksOptions) (*TaskListResponse, error)
ListTasks retrieves a list of tasks with optional filters
func (*Client) ListWebhooks ¶ added in v1.343.0
func (c *Client) ListWebhooks(ctx context.Context, opts *ListWebhooksOptions) (json.RawMessage, error)
ListWebhooks lists webhooks and returns the raw JSON response.
func (*Client) RegenerateWebhookSecret ¶ added in v1.343.0
RegenerateWebhookSecret regenerates the secret for a webhook and returns the raw JSON response.
func (*Client) SearchWithTags ¶ added in v0.5.0
func (c *Client) SearchWithTags(ctx context.Context, status string, tags map[string]string) (*SearchResponse, error)
SearchWithTags lists and filters sessions with tag support
func (*Client) SendMessage ¶
func (c *Client) SendMessage(ctx context.Context, sessionID string, message *Message) (*MessageResponse, error)
SendMessage sends a message to an agentapi session
func (*Client) SendNotification ¶ added in v1.336.0
func (c *Client) SendNotification(ctx context.Context, req *SendNotificationRequest) (*SendNotificationResponse, error)
SendNotification sends a push notification via the API. Either SessionID or UserID must be specified.
func (*Client) Start ¶
func (c *Client) Start(ctx context.Context, req *StartRequest) (*StartResponse, error)
Start creates a new agentapi session
func (*Client) StreamEvents ¶
StreamEvents subscribes to Server-Sent Events (SSE) from an agentapi session
func (*Client) UpdateMemory ¶ added in v1.295.0
func (c *Client) UpdateMemory(ctx context.Context, id string, req *UpdateMemoryRequest) (*MemoryEntry, error)
UpdateMemory updates an existing memory entry
func (*Client) UpdateTask ¶ added in v1.249.0
func (c *Client) UpdateTask(ctx context.Context, taskID string, req *UpdateTaskRequest) (*TaskResponse, error)
UpdateTask partially updates an existing task
func (*Client) UpsertMemory ¶ added in v1.295.0
func (c *Client) UpsertMemory(ctx context.Context, scope, teamID, title, content string, keyTags map[string]string) (*MemoryEntry, error)
UpsertMemory creates or updates a memory entry matching the given key tags. keyTags are used to look up existing memories (AND logic). If exactly one match is found: update it. If no match is found: create a new entry with keyTags merged into the entry's tags. If multiple matches are found: update the most recently updated one.
type ClientOption ¶ added in v1.229.0
type ClientOption func(*Client)
ClientOption is a function that configures a Client
func WithAPIKeyAuth ¶ added in v1.229.0
func WithAPIKeyAuth(apiKey string) ClientOption
WithAPIKeyAuth adds API key authentication middleware
func WithHTTPClient ¶ added in v1.229.0
func WithHTTPClient(httpClient HTTPClient) ClientOption
WithHTTPClient sets a custom HTTP client
func WithRequestMiddleware ¶ added in v1.229.0
func WithRequestMiddleware(middleware RequestMiddleware) ClientOption
WithRequestMiddleware adds a custom request middleware
type Config ¶ added in v1.229.0
Config holds the client configuration
func ConfigFromEnv ¶ added in v1.229.0
ConfigFromEnv creates a client configuration from environment variables
type CreateMemoryRequest ¶ added in v1.295.0
type CreateMemoryRequest struct {
Title string `json:"title"`
Content string `json:"content,omitempty"`
Scope string `json:"scope"`
TeamID string `json:"team_id,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
}
CreateMemoryRequest represents the request to create a memory entry
type CreateTaskRequest ¶ added in v1.249.0
type CreateTaskRequest struct {
Title string `json:"title"`
Description string `json:"description,omitempty"`
TaskType string `json:"task_type"` // "user" or "agent"
Scope string `json:"scope"` // "user" or "team"
TeamID string `json:"team_id,omitempty"` // required when scope=="team"
GroupID string `json:"group_id,omitempty"`
SessionID string `json:"session_id"` // set from function argument
Links []TaskLink `json:"links,omitempty"`
}
CreateTaskRequest represents the request body for creating a new task. SessionID is set automatically from the sessionID function argument.
type DeleteResponse ¶ added in v0.11.0
DeleteResponse represents the response from deleting a session
type HTTPClient ¶ added in v1.229.0
HTTPClient defines the interface for making HTTP requests
type ListSchedulesOptions ¶ added in v1.343.0
type ListSchedulesOptions struct {
Status string // "active", "paused", or "completed"
Scope string // "user" or "team"
TeamID string
}
ListSchedulesOptions specifies optional filters for listing schedules.
type ListSlackBotsOptions ¶ added in v1.343.0
type ListSlackBotsOptions struct {
Status string // "active" or "paused"
Scope string // "user" or "team"
TeamID string
}
ListSlackBotsOptions specifies optional filters for listing SlackBots.
type ListTasksOptions ¶ added in v1.249.0
type ListTasksOptions struct {
Scope string // "user" or "team"
TeamID string
GroupID string
Status string // "todo" or "done"
TaskType string // "user" or "agent"
}
ListTasksOptions specifies optional filters for listing tasks
type ListWebhooksOptions ¶ added in v1.343.0
type ListWebhooksOptions struct {
Type string // "github" or "custom"
Status string // "active" or "paused"
Scope string // "user" or "team"
TeamID string
}
ListWebhooksOptions specifies optional filters for listing webhooks.
type MemoryEntry ¶ added in v1.295.0
type MemoryEntry struct {
ID string `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Tags map[string]string `json:"tags,omitempty"`
Scope string `json:"scope"`
OwnerID string `json:"owner_id"`
TeamID string `json:"team_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
MemoryEntry represents a memory entry from the proxy
type MemoryListResponse ¶ added in v1.295.0
type MemoryListResponse struct {
Memories []*MemoryEntry `json:"memories"`
Total int `json:"total"`
}
MemoryListResponse represents the response from listing memories
type Message ¶
type Message struct {
Content string `json:"content"`
Type string `json:"type"` // "user" or "raw"
Role string `json:"role,omitempty"`
Timestamp time.Time `json:"timestamp,omitempty"`
ID string `json:"id,omitempty"`
}
Message represents an agentapi message
type MessageResponse ¶
type MessageResponse struct {
OK bool `json:"ok"`
}
MessageResponse represents the response from sending a message
type MessagesResponse ¶
type MessagesResponse struct {
Messages []Message `json:"messages"`
}
MessagesResponse represents the response from getting messages
type RequestMiddleware ¶ added in v1.229.0
RequestMiddleware is a function that modifies an HTTP request
type SearchResponse ¶
type SearchResponse struct {
Sessions []SessionInfo `json:"sessions"`
}
SearchResponse represents the response from searching sessions
type SendNotificationRequest ¶ added in v1.336.0
type SendNotificationRequest struct {
Title string `json:"title"`
Body string `json:"body"`
SessionID string `json:"session_id,omitempty"`
UserID string `json:"user_id,omitempty"`
}
SendNotificationRequest represents the request for sending a push notification via API
type SendNotificationResponse ¶ added in v1.336.0
type SendNotificationResponse struct {
Success bool `json:"success"`
Message string `json:"message,omitempty"`
}
SendNotificationResponse represents the response for sending a push notification via API
type SessionInfo ¶
type SessionInfo struct {
SessionID string `json:"session_id"`
UserID string `json:"user_id"`
Status string `json:"status"`
StartedAt time.Time `json:"started_at"`
Port int `json:"port"`
Tags map[string]string `json:"tags,omitempty"`
}
SessionInfo represents information about a session
type StartParams ¶ added in v1.297.0
type StartParams struct {
Message string `json:"message,omitempty"`
Oneshot bool `json:"oneshot,omitempty"`
AgentType string `json:"agent_type,omitempty"`
}
StartParams contains optional session startup parameters.
type StartRequest ¶
type StartRequest struct {
Environment map[string]string `json:"environment,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Params *StartParams `json:"params,omitempty"`
Scope string `json:"scope,omitempty"`
TeamID string `json:"team_id,omitempty"`
MemoryKey map[string]string `json:"memory_key,omitempty"`
}
StartRequest represents the request body for starting a new agentapi server
type StartResponse ¶
type StartResponse struct {
SessionID string `json:"session_id"`
}
StartResponse represents the response from starting a new agentapi server
type StatusResponse ¶
type StatusResponse struct {
Status string `json:"status"` // "stable" or "running"
}
StatusResponse represents the agent status
type TaskLink ¶ added in v1.249.0
type TaskLink struct {
ID string `json:"id,omitempty"`
URL string `json:"url"`
Title string `json:"title,omitempty"`
}
TaskLink represents a link associated with a task
type TaskListResponse ¶ added in v1.249.0
type TaskListResponse struct {
Tasks []*TaskResponse `json:"tasks"`
Total int `json:"total"`
}
TaskListResponse represents a list of tasks
type TaskResponse ¶ added in v1.249.0
type TaskResponse struct {
ID string `json:"id"`
Title string `json:"title"`
Description string `json:"description,omitempty"`
Status string `json:"status"`
TaskType string `json:"task_type"`
Scope string `json:"scope"`
OwnerID string `json:"owner_id"`
TeamID string `json:"team_id,omitempty"`
GroupID string `json:"group_id,omitempty"`
SessionID string `json:"session_id,omitempty"`
Links []TaskLink `json:"links"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
}
TaskResponse represents a single task returned by the API
type UpdateMemoryRequest ¶ added in v1.295.0
type UpdateMemoryRequest struct {
Title string `json:"title,omitempty"`
Content string `json:"content,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
}
UpdateMemoryRequest represents the request to update a memory entry
type UpdateTaskRequest ¶ added in v1.249.0
type UpdateTaskRequest struct {
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
Status *string `json:"status,omitempty"` // "todo" or "done"
GroupID *string `json:"group_id,omitempty"`
SessionID *string `json:"session_id,omitempty"`
Links *[]TaskLink `json:"links,omitempty"`
}
UpdateTaskRequest represents the request body for partially updating a task. Only non-nil fields are updated.