-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* first version of the JSON schema. Fixes issue #27 * addressing feedback from review * addressed steps and agents definition * made agents also array * first version of the agent schema that validares the agents used in POC0 * added code section * included suggestions and changes from @akihikokuroda's PR #139 review comments * first version of schema with conditionals (both if/then/else and case/do/default). Added some tests files in test/schema/conditional_workdlow.<yml/json> * feat(internal): Refactor to provide base Agent class & allow for alternate runtimes (#146) Signed-off-by: Nigel Jones <[email protected]> * feat(bee-hive) add schema validator (#147) Signed-off-by: Akihiko Kuroda <[email protected]> * corrected schema according to @akihikokuroda comments and added a new test based on comments discussions: funnier_workflow.<yml|json> --------- Signed-off-by: Nigel Jones <[email protected]> Signed-off-by: Akihiko Kuroda <[email protected]> Co-authored-by: Nigel Jones <[email protected]> Co-authored-by: Akihiko (Aki) Kuroda <[email protected]>
- Loading branch information
1 parent
2196712
commit 8a0a12e
Showing
6 changed files
with
302 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ | ||
"apiVersion": "beehive/v1", | ||
"kind": "Workflow", | ||
"metadata": { | ||
"name": "beehive-deployment", | ||
"labels": { | ||
"app": "example2" | ||
} | ||
}, | ||
"spec": { | ||
"strategy": { | ||
"type": "sequence" | ||
}, | ||
"template": { | ||
"metadata": { | ||
"name": "beehive-deployment", | ||
"labels": { | ||
"app": "example", | ||
"use-case": "test" | ||
} | ||
} | ||
}, | ||
"agents": [ | ||
"agent1", | ||
"agent2", | ||
"agent3" | ||
], | ||
"exception": "step3", | ||
"steps": [ | ||
{ | ||
"name": "step1", | ||
"agent": "agent1", | ||
"condition": [ | ||
{ | ||
"if": "{$in.some_condition == True}", | ||
"then": "step2", | ||
"else": "step3" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "step2", | ||
"agent": "agent2" | ||
}, | ||
{ | ||
"name": "step3", | ||
"agent": "agent3", | ||
"condition": [ | ||
{ | ||
"case": "{$in.some_condition == True}", | ||
"do": "step2" | ||
}, | ||
{ | ||
"case": "{$in.some_condition == False}", | ||
"do": "step3" | ||
}, | ||
{ | ||
"default": { | ||
"do": "step3" | ||
} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
apiVersion: beehive/v1 | ||
kind: Workflow | ||
metadata: | ||
name: beehive-deployment | ||
labels: | ||
app: example2 | ||
spec: | ||
strategy: | ||
type: sequence | ||
template: | ||
metadata: | ||
name: beehive-deployment | ||
labels: | ||
app: example | ||
use-case: test | ||
agents: | ||
- agent1 | ||
- agent2 | ||
- agent3 | ||
exception: step3 | ||
steps: | ||
- name: step1 | ||
agent: agent1 | ||
condition: | ||
- if: '{$in.some_condition == True}' | ||
then: step2 | ||
else: step3 | ||
- name: step2 | ||
agent: agent2 | ||
- name: step3 | ||
agent: agent3 | ||
condition: | ||
- case: '{$in.some_condition == True}' | ||
do: step2 | ||
- case: '{$in.some_condition == False}' | ||
do: step3 | ||
- default: | ||
do: step3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
{ | ||
"apiVersion": "beehive/v1alpha1", | ||
"kind": "Workflow", | ||
"metadata": { | ||
"name": "beehive-deployment", | ||
"labels": { | ||
"app": "mas-example" | ||
} | ||
}, | ||
"spec": { | ||
"strategy": { | ||
"type": "condition", | ||
"output": "nonal" | ||
}, | ||
"template": { | ||
"metadata": { | ||
"labels": { | ||
"app": "mas-example" | ||
} | ||
}, | ||
"agents": [ | ||
{ | ||
"name": "expert" | ||
}, | ||
{ | ||
"name": "colleague" | ||
} | ||
], | ||
"prompt": "Tell me a joke about IBM", | ||
"start": "expert", | ||
"steps": [ | ||
{ | ||
"name": "expert", | ||
"agent": "expert", | ||
"condition": [ | ||
{ | ||
"default": null, | ||
"do": "colleague" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "colleague", | ||
"agent": "colleague", | ||
"condition": [ | ||
{ | ||
"if": "(input.find('funnier') != -1)", | ||
"then": "expert", | ||
"else": "end" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
apiVersion: beehive/v1alpha1 | ||
kind: Workflow | ||
metadata: | ||
name: beehive-deployment | ||
labels: | ||
app: mas-example | ||
spec: | ||
strategy: | ||
type: condition | ||
output: nonal | ||
template: | ||
metadata: | ||
labels: | ||
app: mas-example | ||
agents: | ||
- name: expert | ||
- name: colleague | ||
prompt: Tell me a joke about IBM | ||
start: expert | ||
steps: | ||
- name: expert | ||
agent: expert | ||
condition: | ||
- default: | ||
do: colleague | ||
- name: colleague | ||
agent: colleague | ||
condition: | ||
- if: { input.find('funnier') != -1 } | ||
then: expert | ||
else: end |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters