Skip to content

Commit 6185fbf

Browse files
Update GRAMMAR documentation.
1 parent 9422cdc commit 6185fbf

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed

doc/GRAMMAR.md

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ The task should include the `filekey` in its list of `agents`:
5757
```yaml
5858
- task:
5959
agents:
60-
- personalities.assistant
60+
- seclab_taskflow_agent.personalities.assistant
6161
...
6262
```
6363

@@ -108,7 +108,7 @@ Example:
108108

109109
### Running templated tasks in a loop
110110

111-
Often we may want to iterate through the same tasks with different inputs. For example, we may want to do fetch all the functions from a code base and then analyze each of the function. This can be done using two consecutive task and with the help of the `repeat_prompt` field.
111+
Often we may want to iterate through the same tasks with different inputs. For example, we may want to fetch all the functions from a code base and then analyze each of the functions. This can be done using two consecutive tasks and with the help of the `repeat_prompt` field.
112112

113113
```yaml
114114
- task:
@@ -124,7 +124,7 @@ Often we may want to iterate through the same tasks with different inputs. For e
124124
The function has name {{ RESULT_name }} and body {{ RESULT_body }} analyze the function.
125125
```
126126

127-
In the above, the first task fetches functions in the code base and create a json list object, with each entry having a `name` and `body` field. In the next task, `repeat_prompt` is set to true, meaning that a task is created for each individual object in the list and the object fields are referenced in the templated prompt using `{{ RESULT_<fieldname> }}`. In other words, `{{ RESULT_name }}` in the prompt is replaced with the value of the `name` field of the object etc. For example, if the list of functions fetched from the first task is:
127+
In the above, the first task fetches functions in the code base and creates a json list object, with each entry having a `name` and `body` field. In the next task, `repeat_prompt` is set to true, meaning that a task is created for each individual object in the list and the object fields are referenced in the templated prompt using `{{ RESULT_<fieldname> }}`. In other words, `{{ RESULT_name }}` in the prompt is replaced with the value of the `name` field of the object etc. For example, if the list of functions fetched from the first task is:
128128

129129
```javascript
130130
[{'name' : foo, 'body' : foo(){return 1;}}, {'name' : bar, 'body' : bar(a) {return a + 1;}}]
@@ -189,7 +189,7 @@ An optional limit can be set to limit the number of asynchronous tasks via `asyn
189189
The function has name {{ RESULT_name }} and body {{ RESULT_body }} analyze the function.
190190
```
191191

192-
Both `async` and `async_limit` have no effect when use outside of a `repeat_prompt`.
192+
Both `async` and `async_limit` have no effect when used outside of a `repeat_prompt`.
193193

194194
At the moment, we do not support nested `repeat_prompt`. So the following is not allowed:
195195

@@ -207,7 +207,7 @@ At the moment, we do not support nested `repeat_prompt`. So the following is not
207207

208208
#### Shell Tasks
209209

210-
Tasks can be entirely shell based through the run directive. This simply runs a shell command and pass the result directly to the next task. It is used for creating iterable results for `repeat_prompt`.
210+
Tasks can be entirely shell based through the run directive. This simply runs a shell command and pass the result directly to the next task. It can be used for creating iterable results for `repeat_prompt`.
211211

212212
For example:
213213

@@ -255,15 +255,15 @@ Toolboxes are MCP server configurations. They can be defined at the Agent level
255255
- task:
256256
...
257257
toolboxes:
258-
- toolboxes.codeql
258+
- seclab_taskflow_agent.toolboxes.codeql
259259
```
260260

261261
If no `toolboxes` is specified, then the `toolboxes` defined in the `personality` of the `agent` is used:
262262

263263
```yaml
264264
- task:
265265
agents:
266-
- personalities.c_auditer
266+
- seclab_taskflow_agent.personalities.c_auditer
267267
user_prompt: |
268268
List all the files in the codeql database `some/codeql/db`.
269269
- task:
@@ -276,15 +276,15 @@ Note that when `toolboxes` is defined for a task, it *overwrites* the `toolboxes
276276
```yaml
277277
- task:
278278
agents:
279-
- personalities.c_auditer
279+
- seclab_taskflow_agent.personalities.c_auditer
280280
user_prompt: |
281281
List all the files in the codeql database `some/codeql/db`.
282282
toolboxes:
283-
- toolboxes.echo
283+
- seclab_taskflow_agent.toolboxes.echo
284284

285285
```
286286

287-
For this task, the `agent` `personalities.c_auditer` will have access to the `toolboxes.echo` tool.
287+
For this task, the `agent` `seclab_taskflow_agent.personalities.c_auditer` will have access to the `seclab_taskflow_agent.toolboxes.echo` tool.
288288

289289
### Headless Runs
290290

@@ -380,11 +380,9 @@ Then the `task` that uses it effectively becomes:
380380
- some_toolboxes
381381
```
382382

383-
which all settings inherited from `single_step_taskflow` while `model` is overwritten.
384-
385383
Any `taskflow` that contains only a single step can be used as a reusable taskflow.
386384

387-
A reusable taskflow can also have templated prompt that takes inputs from its user. This is specified with the `inputs` field from the user.
385+
A reusable taskflow can also have a templated prompt that takes inputs from its user. This is specified with the `inputs` field from the user.
388386

389387
```yaml
390388
- task:
@@ -413,7 +411,7 @@ In this case, the template parameter `{{ INPUTS_fruit }}` is replaced by the val
413411

414412
### Reusable Prompts
415413

416-
Reusable prompts are defined in files of `filetype` `prompts`. These are like macros that gets replaced when a templated parameter of the form `{{ PROMPTS_<filekey> }}` is encountered.
414+
Reusable prompts are defined in files of `filetype` `prompts`. These are like macros that get replaced when a templated parameter of the form `{{ PROMPTS_<filekey> }}` is encountered.
417415

418416
Tasks can incorporate templated prompts which are then replaced by the actual prompt. For example:
419417

@@ -422,13 +420,13 @@ Example:
422420
```yaml
423421
- task:
424422
agents:
425-
- fruit_expert
423+
- examples.personalities.fruit_expert
426424
user_prompt: |
427425
Tell me more about apples.
428-
429-
{{ PROMPTS_prompts.examples.example_prompt }}
426+
427+
{{ PROMPTS_examples.prompts.example_prompt }}
430428
```
431-
and `prompts.examples.example_prompt` is the following:
429+
and `examples.prompts.example_prompt` is the following:
432430

433431
```yaml
434432
seclab-taskflow-agent:
@@ -444,7 +442,7 @@ Then the actual task becomes:
444442
```yaml
445443
- task:
446444
agents:
447-
- fruit_expert
445+
- examples.personalities.fruit_expert
448446
user_prompt: |
449447
Tell me more about apples.
450448
@@ -453,15 +451,14 @@ Then the actual task becomes:
453451

454452
### Model config
455453

456-
LLM models can be configured in a taskflow by setting the `model_config` field to the `filekey` of a file of `filetype` `model_config` :
454+
LLM models can be configured in a taskflow by setting the `model_config` field to the `filekey` of a file of `filetype` `model_config`:
457455

458456
```yaml
459457
seclab-taskflow-agent:
460458
version: 1
461459
filetype: taskflow
462460
463-
model_config: configs.model_config
464-
461+
model_config: examples.model_configs.model_config
465462
```
466463

467464
The variables defined in the `model_config` file can then be used throughout the taskflow, e.g.
@@ -471,7 +468,7 @@ seclab-taskflow-agent:
471468
version: 1
472469
filetype: model_config
473470
models:
474-
gpt_latest: gpt-5
471+
gpt_latest: gpt-5
475472
```
476473

477474
When `gpt_latest` is used in the taskflow to specify a model, the value `gpt-5` is used:
@@ -481,9 +478,9 @@ When `gpt_latest` is used in the taskflow to specify a model, the value `gpt-5`
481478
model: gpt_latest
482479
must_complete: false
483480
agents:
484-
- personalities.c_auditer
481+
- seclab_taskflow_agent.personalities.c_auditer
485482
user_prompt: |
486483
487484
```
488485

489-
This provides a easy way to update model versions in a taskflow.
486+
This provides a easy way to update model versions in a taskflow.

0 commit comments

Comments
 (0)