Documentation
¶
Index ¶
- Constants
- type APIError
- type APIKeyInfo
- type Agent
- type AgentSource
- type AgentStatus
- type AgentTarget
- type AgentsPage
- type AgentsService
- func (s *AgentsService) AddFollowup(ctx context.Context, id string, req FollowupRequest) (string, error)
- func (s *AgentsService) Conversation(ctx context.Context, id string) (*Conversation, error)
- func (s *AgentsService) Create(ctx context.Context, req CreateAgentRequest) (*Agent, error)
- func (s *AgentsService) Delete(ctx context.Context, id string) (string, error)
- func (s *AgentsService) Get(ctx context.Context, id string) (*Agent, error)
- func (s *AgentsService) List(ctx context.Context, opts ListAgentsOptions) (*AgentsPage, error)
- func (s *AgentsService) Stop(ctx context.Context, id string) (string, error)
- func (s *AgentsService) Wait(ctx context.Context, id string, opts WaitOptions) (*Agent, error)
- type Client
- type ClientOption
- type Conversation
- type ConversationMessage
- type ConversationMessageType
- type CreateAgentRequest
- type CreateAgentTarget
- type FollowupRequest
- type HTTPDoer
- type Image
- type ImageDimension
- type ListAgentsOptions
- type MeService
- type ModelList
- type ModelsService
- type Prompt
- type RepositoriesService
- type Repository
- type RequestEditor
- type WaitOptions
- type Webhook
Constants ¶
const DefaultBaseURL = "https://api.cursor.com"
DefaultBaseURL is the default Cursor API base URL.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKeyInfo ¶
APIKeyInfo is returned by the /v0/me endpoint.
type Agent ¶
type Agent struct {
ID string
Name string
Status AgentStatus
Source AgentSource
Target AgentTarget
Summary *string
CreatedAt time.Time
}
Agent is a cloud agent instance.
type AgentSource ¶
type AgentStatus ¶
type AgentStatus string
const ( AgentStatusCreating AgentStatus = "CREATING" AgentStatusRunning AgentStatus = "RUNNING" AgentStatusFinished AgentStatus = "FINISHED" AgentStatusError AgentStatus = "ERROR" AgentStatusExpired AgentStatus = "EXPIRED" )
type AgentTarget ¶
type AgentsPage ¶
AgentsPage is a single page of agents from List.
type AgentsService ¶
type AgentsService struct {
// contains filtered or unexported fields
}
func (*AgentsService) AddFollowup ¶
func (s *AgentsService) AddFollowup(ctx context.Context, id string, req FollowupRequest) (string, error)
AddFollowup adds a follow-up instruction to an existing agent and returns the agent ID.
func (*AgentsService) Conversation ¶
func (s *AgentsService) Conversation(ctx context.Context, id string) (*Conversation, error)
Conversation returns the agent conversation history.
func (*AgentsService) Create ¶
func (s *AgentsService) Create(ctx context.Context, req CreateAgentRequest) (*Agent, error)
Create launches a new agent.
func (*AgentsService) Delete ¶
Delete permanently deletes an agent and returns the deleted agent ID.
func (*AgentsService) List ¶
func (s *AgentsService) List(ctx context.Context, opts ListAgentsOptions) (*AgentsPage, error)
List returns a single page of agents.
func (*AgentsService) Wait ¶
func (s *AgentsService) Wait(ctx context.Context, id string, opts WaitOptions) (*Agent, error)
Wait polls Get until the agent reaches a terminal state (FINISHED, ERROR, EXPIRED), or the context is cancelled.
type Client ¶
type Client struct {
Agents *AgentsService
Me *MeService
Models *ModelsService
Repositories *RepositoriesService
// contains filtered or unexported fields
}
Client is the public Cursor Cloud Agents API client.
It wraps the generated OpenAPI client in internal/oapi, keeping generated code as an implementation detail while providing a stable, ergonomic API surface.
type ClientOption ¶
type ClientOption func(*clientOptions) error
ClientOption configures a Client.
func WithBaseURL ¶
func WithBaseURL(baseURL string) ClientOption
WithBaseURL overrides the default API base URL.
func WithHTTPClient ¶
func WithHTTPClient(httpClient HTTPDoer) ClientOption
WithHTTPClient overrides the underlying HTTP client used for requests.
func WithRequestEditor ¶
func WithRequestEditor(editor RequestEditor) ClientOption
WithRequestEditor registers a function to mutate outgoing requests.
func WithUserAgent ¶
func WithUserAgent(userAgent string) ClientOption
WithUserAgent sets a custom User-Agent header on all requests.
type Conversation ¶
type Conversation struct {
AgentID string
Messages []ConversationMessage
}
Conversation is the conversation history for an agent.
type ConversationMessage ¶
type ConversationMessage struct {
ID string
Type ConversationMessageType
Text string
}
type ConversationMessageType ¶
type ConversationMessageType string
const ( ConversationMessageTypeUser ConversationMessageType = "user_message" ConversationMessageTypeAssistant ConversationMessageType = "assistant_message" )
type CreateAgentRequest ¶
type CreateAgentRequest struct {
Prompt Prompt
Model *string
Source AgentSource
Target *CreateAgentTarget
Webhook *Webhook
}
CreateAgentRequest launches an agent.
type CreateAgentTarget ¶
type FollowupRequest ¶
type FollowupRequest struct {
Prompt Prompt
}
FollowupRequest adds a follow-up prompt to an existing agent.
type Image ¶
type Image struct {
Data string
Dimension *ImageDimension
}
Image is base64-encoded image data with optional dimensions.
type ImageDimension ¶
ImageDimension describes an image's size in pixels.
type ListAgentsOptions ¶
ListAgentsOptions controls pagination for listing agents.
type ModelList ¶
type ModelList struct {
Models []string
}
ModelList is returned by the /v0/models endpoint.
type ModelsService ¶
type ModelsService struct {
// contains filtered or unexported fields
}
type RepositoriesService ¶
type RepositoriesService struct {
// contains filtered or unexported fields
}
func (*RepositoriesService) List ¶
func (s *RepositoriesService) List(ctx context.Context) ([]Repository, error)
List returns GitHub repositories accessible to the authenticated user.
type Repository ¶
Repository is returned by the /v0/repositories endpoint.
type RequestEditor ¶
RequestEditor can mutate outgoing HTTP requests.