Documentation
¶
Index ¶
- Constants
- Variables
- type EventPayload
- type Handler
- type HandlerFunc
- type Job
- type JobAdmin
- type JobFilter
- type JobState
- type Lease
- type LeaseRenewer
- type MemoryReconcilePayload
- type PauseResult
- type Queue
- type QueueMetrics
- type ResumeContinuePayload
- type RunPausedError
- type RunPayload
- type Worker
- type WorkerConfig
Constants ¶
View Source
const EventJobType = "event"
View Source
const MemoryReconcileJobType = "memory.reconcile"
View Source
const ResumeContinueJobType = "resume.continue"
View Source
const RunJobType = "run"
Variables ¶
Functions ¶
This section is empty.
Types ¶
type EventPayload ¶ added in v0.1.2
type EventPayload struct {
Type string `json:"type"`
RunID string `json:"run_id,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
MaxAttempts int `json:"max_attempts,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Principal identity.Principal `json:"principal,omitempty"`
}
func (EventPayload) Event ¶ added in v0.1.2
func (payload EventPayload) Event() eventrouter.Event
type HandlerFunc ¶
type Job ¶
type Job struct {
ID string `json:"id"`
Type string `json:"type"`
RunID string `json:"run_id,omitempty"`
Payload json.RawMessage `json:"payload,omitempty"`
State JobState `json:"state"`
Attempts int `json:"attempts"`
MaxAttempts int `json:"max_attempts"`
LastError string `json:"last_error,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
AvailableAt time.Time `json:"available_at"`
LeaseWorkerID string `json:"lease_worker_id,omitempty"`
LeaseExpiresAt time.Time `json:"lease_expires_at,omitempty"`
}
type JobAdmin ¶ added in v0.1.4
type JobAdmin interface {
ListJobs(ctx context.Context, filter JobFilter) ([]Job, error)
Requeue(ctx context.Context, jobID string) error
}
JobAdmin extends Queue with dead-letter inspection and requeue support.
type LeaseRenewer ¶
type MemoryReconcilePayload ¶ added in v0.1.9
type MemoryReconcilePayload struct {
MemoryName string `json:"memory_name"`
Agent string `json:"agent"`
RunID string `json:"run_id,omitempty"`
Principal identity.Principal `json:"principal,omitempty"`
}
func (MemoryReconcilePayload) MarshalJSONBytes ¶ added in v0.1.9
func (payload MemoryReconcilePayload) MarshalJSONBytes() (json.RawMessage, error)
type PauseResult ¶ added in v0.3.0
PauseResult carries metadata persisted when a job pauses for HITL.
type Queue ¶
type Queue interface {
Enqueue(ctx context.Context, job Job) (Job, error)
Lease(ctx context.Context, workerID string, ttl time.Duration) (Lease, bool, error)
Load(ctx context.Context, jobID string) (Job, error)
Complete(ctx context.Context, lease Lease) error
Pause(ctx context.Context, lease Lease, result PauseResult) error
Fail(ctx context.Context, lease Lease, cause error) error
Cancel(ctx context.Context, jobID string) error
}
type QueueMetrics ¶ added in v0.1.4
QueueMetrics summarizes queue depth by state.
func CollectQueueMetrics ¶ added in v0.1.4
func CollectQueueMetrics(ctx context.Context, queue Queue) (QueueMetrics, error)
CollectQueueMetrics counts jobs by state when the queue implements JobAdmin.
type ResumeContinuePayload ¶ added in v0.1.2
type ResumeContinuePayload struct {
Token string `json:"token"`
Decision core.Decision `json:"decision"`
Amendment json.RawMessage `json:"amendment,omitempty"`
RunID string `json:"run_id,omitempty"`
MaxAttempts int `json:"max_attempts,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Principal identity.Principal `json:"principal,omitempty"`
}
type RunPausedError ¶ added in v0.3.0
RunPausedError indicates a run job paused awaiting human approval. Workers should mark the job as paused rather than completed or failed.
func (RunPausedError) Error ¶ added in v0.3.0
func (e RunPausedError) Error() string
type RunPayload ¶
type RunPayload struct {
RunID string `json:"run_id,omitempty"`
ScenarioID string `json:"scenario_id,omitempty"`
Scenario json.RawMessage `json:"scenario,omitempty"`
Agent string `json:"agent,omitempty"`
Prompt string `json:"prompt,omitempty"`
Context json.RawMessage `json:"context,omitempty"`
MaxAttempts int `json:"max_attempts,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Principal identity.Principal `json:"principal,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.