Skip to content

Commit

Permalink
feat: playbook agents
Browse files Browse the repository at this point in the history
* playbook run listener support playbook_run as the parent not just
  notification_send

[skip ci]
  • Loading branch information
adityathebe committed Jan 8, 2025
1 parent 4e54e54 commit 82d2e50
Show file tree
Hide file tree
Showing 20 changed files with 560 additions and 127 deletions.
2 changes: 2 additions & 0 deletions api/v1/playbook_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ type AIAction struct {
AIActionClient `json:",inline" yaml:",inline"`
AIActionContext `json:",inline" yaml:",inline" template:"true"`

PlaybookAgents []types.ResourceSelector `json:"playbookAgents,omitempty"`

// Specify selectors for playbooks. The LLM will recommend the best suited playbooks
// in response to the prompt.
RecommendPlaybooks []types.ResourceSelector `json:"recommendPlaybooks,omitempty"`
Expand Down
7 changes: 7 additions & 0 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions config/crds/mission-control.flanksource.com_incidentrules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,11 @@ spec:
type: string
fieldSelector:
type: string
healths:
description: Healths filter resources by the health
items:
type: string
type: array
health:
description: |-
Health filters resources by the health.
Multiple healths can be provided separated by comma.
type: string
id:
type: string
includeDeleted:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ spec:
type: string
fieldSelector:
type: string
healths:
description: Healths filter resources by the health
items:
type: string
type: array
health:
description: |-
Health filters resources by the health.
Multiple healths can be provided separated by comma.
type: string
id:
type: string
includeDeleted:
Expand Down
30 changes: 15 additions & 15 deletions config/crds/mission-control.flanksource.com_permissions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ spec:
type: string
fieldSelector:
type: string
healths:
description: Healths filter resources by the health
items:
type: string
type: array
health:
description: |-
Health filters resources by the health.
Multiple healths can be provided separated by comma.
type: string
id:
type: string
includeDeleted:
Expand Down Expand Up @@ -142,11 +142,11 @@ spec:
type: string
fieldSelector:
type: string
healths:
description: Healths filter resources by the health
items:
type: string
type: array
health:
description: |-
Health filters resources by the health.
Multiple healths can be provided separated by comma.
type: string
id:
type: string
includeDeleted:
Expand Down Expand Up @@ -202,11 +202,11 @@ spec:
type: string
fieldSelector:
type: string
healths:
description: Healths filter resources by the health
items:
type: string
type: array
health:
description: |-
Health filters resources by the health.
Multiple healths can be provided separated by comma.
type: string
id:
type: string
includeDeleted:
Expand Down
100 changes: 80 additions & 20 deletions config/crds/mission-control.flanksource.com_playbooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,66 @@ spec:
Model name based on the backend chosen.
Example: gpt-4o for openai, claude-3-5-sonnet-latest for Anthropic, llama3.1:8b for Ollama
type: string
playbookAgents:
items:
properties:
agent:
description: |-
Agent can be the agent id or the name of the agent.
Additionally, the special "self" value can be used to select resources without an agent.
type: string
cache:
description: |-
Cache directives
'no-cache' (should not fetch from cache but can be cached)
'no-store' (should not cache)
'max-age=X' (cache for X duration)
type: string
fieldSelector:
type: string
health:
description: |-
Health filters resources by the health.
Multiple healths can be provided separated by comma.
type: string
id:
type: string
includeDeleted:
type: boolean
labelSelector:
type: string
limit:
type: integer
name:
type: string
namespace:
type: string
scope:
description: |-
Scope is the reference for parent of the resource to select.
For config items, the scope is the scraper id
For checks, it's canaries and
For components, it's topology.
It can either be a uuid or namespace/name
type: string
search:
description: Search query that applies to the resource
name, tag & labels.
type: string
statuses:
description: Statuses filter resources by the status
items:
type: string
type: array
tagSelector:
type: string
types:
description: Types filter resources by the type
items:
type: string
type: array
type: object
type: array
prompt:
description: Prompt is the human prompt
type: string
Expand All @@ -159,11 +219,11 @@ spec:
type: string
fieldSelector:
type: string
healths:
description: Healths filter resources by the health
items:
type: string
type: array
health:
description: |-
Health filters resources by the health.
Multiple healths can be provided separated by comma.
type: string
id:
type: string
includeDeleted:
Expand Down Expand Up @@ -1478,11 +1538,11 @@ spec:
type: string
fieldSelector:
type: string
healths:
description: Healths filter resources by the health
items:
type: string
type: array
health:
description: |-
Health filters resources by the health.
Multiple healths can be provided separated by comma.
type: string
id:
type: string
includeDeleted:
Expand Down Expand Up @@ -1539,11 +1599,11 @@ spec:
type: string
fieldSelector:
type: string
healths:
description: Healths filter resources by the health
items:
type: string
type: array
health:
description: |-
Health filters resources by the health.
Multiple healths can be provided separated by comma.
type: string
id:
type: string
includeDeleted:
Expand Down Expand Up @@ -1600,11 +1660,11 @@ spec:
type: string
fieldSelector:
type: string
healths:
description: Healths filter resources by the health
items:
type: string
type: array
health:
description: |-
Health filters resources by the health.
Multiple healths can be provided separated by comma.
type: string
id:
type: string
includeDeleted:
Expand Down
6 changes: 3 additions & 3 deletions config/schemas/incident-rules.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,14 @@
"fieldSelector": {
"type": "string"
},
"health": {
"type": "string"
},
"types": {
"$ref": "#/$defs/Items"
},
"statuses": {
"$ref": "#/$defs/Items"
},
"healths": {
"$ref": "#/$defs/Items"
}
},
"additionalProperties": false,
Expand Down
6 changes: 3 additions & 3 deletions config/schemas/notificationsilence.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -228,14 +228,14 @@
"fieldSelector": {
"type": "string"
},
"health": {
"type": "string"
},
"types": {
"$ref": "#/$defs/Items"
},
"statuses": {
"$ref": "#/$defs/Items"
},
"healths": {
"$ref": "#/$defs/Items"
}
},
"additionalProperties": false,
Expand Down
6 changes: 3 additions & 3 deletions config/schemas/permission.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,14 +281,14 @@
"fieldSelector": {
"type": "string"
},
"health": {
"type": "string"
},
"types": {
"$ref": "#/$defs/Items"
},
"statuses": {
"$ref": "#/$defs/Items"
},
"healths": {
"$ref": "#/$defs/Items"
}
},
"additionalProperties": false,
Expand Down
12 changes: 9 additions & 3 deletions config/schemas/playbook-spec.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
},
"type": "array"
},
"playbookAgents": {
"items": {
"$ref": "#/$defs/ResourceSelector"
},
"type": "array"
},
"recommendPlaybooks": {
"items": {
"$ref": "#/$defs/ResourceSelector"
Expand Down Expand Up @@ -1031,14 +1037,14 @@
"fieldSelector": {
"type": "string"
},
"health": {
"type": "string"
},
"types": {
"$ref": "#/$defs/Items"
},
"statuses": {
"$ref": "#/$defs/Items"
},
"healths": {
"$ref": "#/$defs/Items"
}
},
"additionalProperties": false,
Expand Down
12 changes: 9 additions & 3 deletions config/schemas/playbook.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
},
"type": "array"
},
"playbookAgents": {
"items": {
"$ref": "#/$defs/ResourceSelector"
},
"type": "array"
},
"recommendPlaybooks": {
"items": {
"$ref": "#/$defs/ResourceSelector"
Expand Down Expand Up @@ -1185,14 +1191,14 @@
"fieldSelector": {
"type": "string"
},
"health": {
"type": "string"
},
"types": {
"$ref": "#/$defs/Items"
},
"statuses": {
"$ref": "#/$defs/Items"
},
"healths": {
"$ref": "#/$defs/Items"
}
},
"additionalProperties": false,
Expand Down
Loading

0 comments on commit 82d2e50

Please sign in to comment.