Documentation
¶
Index ¶
- func NewClientFromEnv() (*Client, *Config, error)
- type Client
- func (c *Client) DeleteSession(ctx context.Context, sessionID string) (*DeleteResponse, error)
- func (c *Client) GetMessages(ctx context.Context, sessionID string) (*MessagesResponse, error)
- func (c *Client) GetStatus(ctx context.Context, sessionID string) (*StatusResponse, 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) Start(ctx context.Context, req *StartRequest) (*StartResponse, error)
- func (c *Client) StreamEvents(ctx context.Context, sessionID string) (<-chan string, <-chan error)
- type ClientOption
- type Config
- type DeleteResponse
- type HTTPClient
- type Message
- type MessageResponse
- type MessagesResponse
- type RequestMiddleware
- type SearchResponse
- type SessionInfo
- type StartRequest
- type StartResponse
- type StatusResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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) DeleteSession ¶ added in v0.11.0
DeleteSession terminates and deletes a session
func (*Client) GetMessages ¶
GetMessages retrieves conversation history from an agentapi session
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) Start ¶
func (c *Client) Start(ctx context.Context, req *StartRequest) (*StartResponse, error)
Start creates a new agentapi session
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 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 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 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 StartRequest ¶
type StartRequest struct {
Environment map[string]string `json:"environment,omitempty"`
Tags map[string]string `json:"tags,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