You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+25-2Lines changed: 25 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -198,7 +198,7 @@ toolboxes:
198
198
```
199
199
200
200
In the above, the `personality` and `task` field specifies the system prompt to be used whenever this `personality` is used.
201
-
The `toolboxes` are the tools that are available to this `personality`. The `toolboxes` should be a list of `filekey` specifying files of the `filetype` `toolbox`.
201
+
The `toolboxes` are the tools that are available to this `personality`. The `toolboxes` should be a list of files of the `filetype` `toolbox`. (See the [Import paths](#import-paths) section for how to reference other files.)
202
202
203
203
Personalities can be used in two ways. First it can be used standalone with a prompt input from the command line:
204
204
@@ -382,7 +382,7 @@ hatch run main -t examples.taskflows.CVE-2023-2283
382
382
383
383
Prompts are configured through YAML files of `filetype` `prompt`. They define a reusable prompt that can be referenced in `taskflow` files.
384
384
385
-
They contain only one field, the `prompt` field, which is used to replace any `{{ PROMPT_<filekey> }}` template parameter in a taskflow. For example, the following `prompt`.
385
+
They contain only one field, the `prompt` field, which is used to replace any `{{ PROMPT_<import-path> }}` template parameter in a taskflow. For example, the following `prompt`.
386
386
387
387
```yaml
388
388
seclab-taskflow-agent:
@@ -475,6 +475,29 @@ This overwrites the environment variables `MEMCACHE_STATE_DIR` and `MEMCACHE_BAC
475
475
476
476
Note that when using the template `{{ env ENV_VARIABLE_NAME }}`, `ENV_VARIABLE_NAME` must be the name of an environment variable in the current process.
477
477
478
+
## Import paths
479
+
480
+
YAML files often need to refer to each other. For example, a taskflow can reference a personality like this:
481
+
482
+
```yaml
483
+
taskflow:
484
+
- task:
485
+
...
486
+
agents:
487
+
- seclab_taskflow_agent.personalities.assistant
488
+
```
489
+
490
+
We use Python's import system, so a name like `seclab_taskflow_agent.personalities.assistant` will get resolved to a YAML file using Python's import rules. One of the benefits of this is that it makes it easy to bundle and share taskflows as Python packages on PyPI.
491
+
492
+
The implementation works like this:
493
+
494
+
1. A name like `seclab_taskflow_agent.personalities.assistant` gets split (at the last `.` character) into a package name (`seclab_taskflow_agent.personalities`) and a file name (`assistant`).
495
+
2. Python's [`importlib.resources.files`](https://docs.python.org/3/library/importlib.resources.html#importlib.resources.files) is used to resolve the package name into a directory name.
496
+
3. The extension `.yaml` is added to the filename: `assistant.yaml`.
497
+
4. The yaml file is loaded from the directory that was returned by `importlib.resources.files`.
498
+
499
+
The exact code that implements this can be found in [`available_tools.py`](src/seclab_taskflow_agent/available_tools.py).
500
+
478
501
## License
479
502
480
503
This project is licensed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license. Please refer to the [LICENSE](./LICENSE) file for the full terms.
Copy file name to clipboardExpand all lines: doc/GRAMMAR.md
+29-29Lines changed: 29 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ Example:
21
21
```yaml
22
22
- task:
23
23
agents:
24
-
- assistant
24
+
- seclab_taskflow_agent.personalities.assistant
25
25
user_prompt: |
26
26
This is a user prompt.
27
27
```
@@ -30,7 +30,7 @@ Note: The exception to this rule are `run` shell tasks.
30
30
31
31
### Agents
32
32
33
-
Agents define the system prompt to be used for the task. It contains a list of `filekey` pointing to files of `personality` `filetype`.
33
+
`agents`defines the system prompt to be used for the task. It contains a list of files of type `personality`.
34
34
35
35
For example, to use the `personality` defined in the following:
36
36
@@ -52,7 +52,7 @@ toolboxes:
52
52
- ...
53
53
```
54
54
55
-
The task should include the `filekey` in its list of `agents`:
55
+
The task should include the personality YAML file in its list of `agents`:
56
56
57
57
```yaml
58
58
- task:
@@ -84,7 +84,7 @@ Tasks can optionally specify which Model to use on the configured inference endp
84
84
- task:
85
85
model: gpt-4.1
86
86
agents:
87
-
- assistant
87
+
- seclab_taskflow_agent.personalities.assistant
88
88
user_prompt: |
89
89
This is a user prompt.
90
90
```
@@ -101,7 +101,7 @@ Example:
101
101
- task:
102
102
must_complete: true
103
103
agents:
104
-
- assistant
104
+
- seclab_taskflow_agent.personalities.assistant
105
105
user_prompt: |
106
106
...
107
107
```
@@ -113,13 +113,13 @@ Often we may want to iterate through the same tasks with different inputs. For e
113
113
```yaml
114
114
- task:
115
115
agents:
116
-
- assistant
116
+
- seclab_taskflow_agent.personalities.assistant
117
117
user_prompt: |
118
118
Fetch all the functions in the code base and create a list with entries of the form {'name' : <function_name>, 'body' : <function_body>}
119
119
- task:
120
120
repeat_prompt: true
121
121
agents:
122
-
- c_auditer
122
+
- seclab_taskflow_agent.personalities.c_auditer
123
123
user_prompt: |
124
124
The function has name {{ RESULT_name }} and body {{ RESULT_body }} analyze the function.
125
125
```
@@ -147,7 +147,7 @@ The iterable can also contain a list of primitives like string or number, in whi
147
147
max_steps: 5
148
148
must_complete: true
149
149
agents:
150
-
- personalities.assistant
150
+
- seclab_taskflow_agent.personalities.assistant
151
151
user_prompt: |
152
152
Store the json array [1, 2, 3] in memory under the
153
153
`test_repeat_prompt` key as a json object, then retrieve
@@ -159,7 +159,7 @@ The iterable can also contain a list of primitives like string or number, in whi
159
159
must_complete: true
160
160
repeat_prompt: true
161
161
agents:
162
-
- personalities.assistant
162
+
- seclab_taskflow_agent.personalities.assistant
163
163
user_prompt: |
164
164
What is the integer value of {{ RESULT }}?
165
165
```
@@ -171,7 +171,7 @@ Repeat prompt can be run in parallel by setting the `async` field to `true`:
171
171
repeat_prompt: true
172
172
async: true
173
173
agents:
174
-
- c_auditer
174
+
- seclab_taskflow_agent.personalities.c_auditer
175
175
user_prompt: |
176
176
The function has name {{ RESULT_name }} and body {{ RESULT_body }} analyze the function.
177
177
```
@@ -184,7 +184,7 @@ An optional limit can be set to limit the number of asynchronous tasks via `asyn
184
184
async: true
185
185
async_limit: 3
186
186
agents:
187
-
- c_auditer
187
+
- seclab_taskflow_agent.personalities.c_auditer
188
188
user_prompt: |
189
189
The function has name {{ RESULT_name }} and body {{ RESULT_body }} analyze the function.
190
190
```
@@ -197,7 +197,7 @@ At the moment, we do not support nested `repeat_prompt`. So the following is not
197
197
- task:
198
198
repeat_prompt: true
199
199
agents:
200
-
- c_auditer
200
+
- seclab_taskflow_agent.personalities.c_auditer
201
201
user_prompt: |
202
202
The function has name {{ RESULT_name }} and body {{ RESULT_body }} analyze the function.
203
203
- task:
@@ -219,7 +219,7 @@ For example:
219
219
- task:
220
220
repeat_prompt: true
221
221
agents:
222
-
- assistant
222
+
- seclab_taskflow_agent.personalities.assistant
223
223
user_prompt: |
224
224
What kind of fruit is {{ RESULT }}?
225
225
```
@@ -240,16 +240,16 @@ Example:
240
240
- task:
241
241
exclude_from_context: true
242
242
agents:
243
-
- assistant
243
+
- seclab_taskflow_agent.personalities.assistant
244
244
user_prompt: |
245
245
List all the files in the codeql database `some/codeql/db`.
246
246
toolboxes:
247
-
- codeql
247
+
- seclab_taskflow_agent.toolboxes.codeql
248
248
```
249
249
250
250
### Toolboxes / MCP Servers
251
251
252
-
Toolboxes are MCP server configurations. They can be defined at the Agent level or overridden at the task level. These MCP servers are started and made available to the Agents in the Agents list during a Task. The `toolboxes` field should contain a list of `filekey` for the `toolboxes` that are available for the task:
252
+
Toolboxes are MCP server configurations. They can be defined at the Agent level or overridden at the task level. These MCP servers are started and made available to the Agents in the Agents list during a Task. The `toolboxes` field should contain a list of files for the `toolboxes` that are available for the task:
253
253
254
254
```yaml
255
255
- task:
@@ -258,7 +258,7 @@ Toolboxes are MCP server configurations. They can be defined at the Agent level
258
258
- seclab_taskflow_agent.toolboxes.codeql
259
259
```
260
260
261
-
If no `toolboxes` is specified, then the `toolboxes` defined in the `personality` of the `agent` is used:
261
+
If no `toolboxes` are specified, then the `toolboxes` defined in the `personality` of the `agent` are used:
262
262
263
263
```yaml
264
264
- task:
@@ -269,7 +269,7 @@ If no `toolboxes` is specified, then the `toolboxes` defined in the `personality
269
269
- task:
270
270
```
271
271
272
-
In the above `task`, as no `toolboxes` is specified, the `toolboxes` defined in the `personality` of `personalities.c_auditer` is used.
272
+
In the above `task`, as no `toolboxes` is specified, the `toolboxes` defined in the `personality` of `seclab_taskflow_agent.personalities.c_auditer` is used.
273
273
274
274
Note that when `toolboxes` is defined for a task, it *overwrites* the `toolboxes` that are available. For example, in the following `task`:
275
275
@@ -296,7 +296,7 @@ Example:
296
296
- task:
297
297
headless: true
298
298
agents:
299
-
- assistant
299
+
- seclab_taskflow_agent.personalities.assistant
300
300
user_prompt: |
301
301
Clear the memory cache.
302
302
toolboxes:
@@ -313,11 +313,11 @@ Example:
313
313
- task:
314
314
headless: true
315
315
agents:
316
-
- assistant
316
+
- seclab_taskflow_agent.personalities.assistant
317
317
user_prompt: |
318
318
Store `hello` in the memory key `world`.
319
319
toolboxes:
320
-
- memcache
320
+
- seclab_taskflow_agent.toolboxes.memcache
321
321
env:
322
322
MEMCACHE_STATE_DIR: "example_taskflow/"
323
323
MEMCACHE_BACKEND: "dictionary_file"
@@ -335,20 +335,20 @@ globals:
335
335
taskflow:
336
336
- task:
337
337
agents:
338
-
- fruit_expert
338
+
- examples.personalities.fruit_expert
339
339
user_prompt: |
340
340
Tell me more about {{ GLOBALS_fruit }}.
341
341
```
342
342
343
343
### Reusable Tasks
344
344
345
-
Tasks can reuse single step taskflows and optionally override any of its configurations. This is done by setting a `uses` field with the `filekey` of the single step taskflow as its value.
345
+
Tasks can reuse single step taskflows and optionally override any of its configurations. This is done by setting a `uses` field with a link to the single step taskflow YAML file as its value.
346
346
347
347
Example:
348
348
349
349
```yaml
350
350
- task:
351
-
uses: single_step_taskflow
351
+
uses: examples.taskflows.single_step_taskflow
352
352
model: gpt-4o
353
353
```
354
354
@@ -386,15 +386,15 @@ A reusable taskflow can also have a templated prompt that takes inputs from its
386
386
387
387
```yaml
388
388
- task:
389
-
uses: single_step_taskflow
389
+
uses: examples.taskflows.single_step_taskflow
390
390
inputs:
391
391
fruit: apples
392
392
```
393
393
394
394
```yaml
395
395
- task:
396
396
agents:
397
-
- fruit_expert
397
+
- examples.personalities.fruit_expert
398
398
user_prompt: |
399
399
Tell me more about {{ INPUTS_fruit }}.
400
400
```
@@ -404,14 +404,14 @@ In this case, the template parameter `{{ INPUTS_fruit }}` is replaced by the val
404
404
```yaml
405
405
- task:
406
406
agents:
407
-
- fruit_expert
407
+
- examples.personalities.fruit_expert
408
408
user_prompt: |
409
409
Tell me more about apples.
410
410
```
411
411
412
412
### Reusable Prompts
413
413
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.
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_<import-path> }}` is encountered.
415
415
416
416
Tasks can incorporate templated prompts which are then replaced by the actual prompt. For example:
417
417
@@ -451,7 +451,7 @@ Then the actual task becomes:
451
451
452
452
### Model config
453
453
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`:
454
+
LLM models can be configured in a taskflow by setting the `model_config` field to a file of type `model_config`:
0 commit comments