Skip to content

Commit d1ca17d

Browse files
Remove the word "filekey" from the documentation.
1 parent cb2e189 commit d1ca17d

File tree

2 files changed

+54
-31
lines changed

2 files changed

+54
-31
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ toolboxes:
198198
```
199199

200200
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.)
202202

203203
Personalities can be used in two ways. First it can be used standalone with a prompt input from the command line:
204204

@@ -382,7 +382,7 @@ hatch run main -t examples.taskflows.CVE-2023-2283
382382

383383
Prompts are configured through YAML files of `filetype` `prompt`. They define a reusable prompt that can be referenced in `taskflow` files.
384384

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`.
386386

387387
```yaml
388388
seclab-taskflow-agent:
@@ -475,6 +475,29 @@ This overwrites the environment variables `MEMCACHE_STATE_DIR` and `MEMCACHE_BAC
475475

476476
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.
477477

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+
478501
## License
479502

480503
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.

doc/GRAMMAR.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Example:
2121
```yaml
2222
- task:
2323
agents:
24-
- assistant
24+
- seclab_taskflow_agent.personalities.assistant
2525
user_prompt: |
2626
This is a user prompt.
2727
```
@@ -30,7 +30,7 @@ Note: The exception to this rule are `run` shell tasks.
3030

3131
### Agents
3232

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`.
3434

3535
For example, to use the `personality` defined in the following:
3636

@@ -52,7 +52,7 @@ toolboxes:
5252
- ...
5353
```
5454

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`:
5656

5757
```yaml
5858
- task:
@@ -84,7 +84,7 @@ Tasks can optionally specify which Model to use on the configured inference endp
8484
- task:
8585
model: gpt-4.1
8686
agents:
87-
- assistant
87+
- seclab_taskflow_agent.personalities.assistant
8888
user_prompt: |
8989
This is a user prompt.
9090
```
@@ -101,7 +101,7 @@ Example:
101101
- task:
102102
must_complete: true
103103
agents:
104-
- assistant
104+
- seclab_taskflow_agent.personalities.assistant
105105
user_prompt: |
106106
...
107107
```
@@ -113,13 +113,13 @@ Often we may want to iterate through the same tasks with different inputs. For e
113113
```yaml
114114
- task:
115115
agents:
116-
- assistant
116+
- seclab_taskflow_agent.personalities.assistant
117117
user_prompt: |
118118
Fetch all the functions in the code base and create a list with entries of the form {'name' : <function_name>, 'body' : <function_body>}
119119
- task:
120120
repeat_prompt: true
121121
agents:
122-
- c_auditer
122+
- seclab_taskflow_agent.personalities.c_auditer
123123
user_prompt: |
124124
The function has name {{ RESULT_name }} and body {{ RESULT_body }} analyze the function.
125125
```
@@ -147,7 +147,7 @@ The iterable can also contain a list of primitives like string or number, in whi
147147
max_steps: 5
148148
must_complete: true
149149
agents:
150-
- personalities.assistant
150+
- seclab_taskflow_agent.personalities.assistant
151151
user_prompt: |
152152
Store the json array [1, 2, 3] in memory under the
153153
`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
159159
must_complete: true
160160
repeat_prompt: true
161161
agents:
162-
- personalities.assistant
162+
- seclab_taskflow_agent.personalities.assistant
163163
user_prompt: |
164164
What is the integer value of {{ RESULT }}?
165165
```
@@ -171,7 +171,7 @@ Repeat prompt can be run in parallel by setting the `async` field to `true`:
171171
repeat_prompt: true
172172
async: true
173173
agents:
174-
- c_auditer
174+
- seclab_taskflow_agent.personalities.c_auditer
175175
user_prompt: |
176176
The function has name {{ RESULT_name }} and body {{ RESULT_body }} analyze the function.
177177
```
@@ -184,7 +184,7 @@ An optional limit can be set to limit the number of asynchronous tasks via `asyn
184184
async: true
185185
async_limit: 3
186186
agents:
187-
- c_auditer
187+
- seclab_taskflow_agent.personalities.c_auditer
188188
user_prompt: |
189189
The function has name {{ RESULT_name }} and body {{ RESULT_body }} analyze the function.
190190
```
@@ -197,7 +197,7 @@ At the moment, we do not support nested `repeat_prompt`. So the following is not
197197
- task:
198198
repeat_prompt: true
199199
agents:
200-
- c_auditer
200+
- seclab_taskflow_agent.personalities.c_auditer
201201
user_prompt: |
202202
The function has name {{ RESULT_name }} and body {{ RESULT_body }} analyze the function.
203203
- task:
@@ -219,7 +219,7 @@ For example:
219219
- task:
220220
repeat_prompt: true
221221
agents:
222-
- assistant
222+
- seclab_taskflow_agent.personalities.assistant
223223
user_prompt: |
224224
What kind of fruit is {{ RESULT }}?
225225
```
@@ -240,16 +240,16 @@ Example:
240240
- task:
241241
exclude_from_context: true
242242
agents:
243-
- assistant
243+
- seclab_taskflow_agent.personalities.assistant
244244
user_prompt: |
245245
List all the files in the codeql database `some/codeql/db`.
246246
toolboxes:
247-
- codeql
247+
- seclab_taskflow_agent.toolboxes.codeql
248248
```
249249
250250
### Toolboxes / MCP Servers
251251
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:
253253

254254
```yaml
255255
- task:
@@ -258,7 +258,7 @@ Toolboxes are MCP server configurations. They can be defined at the Agent level
258258
- seclab_taskflow_agent.toolboxes.codeql
259259
```
260260

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:
262262

263263
```yaml
264264
- task:
@@ -269,7 +269,7 @@ If no `toolboxes` is specified, then the `toolboxes` defined in the `personality
269269
- task:
270270
```
271271
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.
273273

274274
Note that when `toolboxes` is defined for a task, it *overwrites* the `toolboxes` that are available. For example, in the following `task`:
275275

@@ -296,7 +296,7 @@ Example:
296296
- task:
297297
headless: true
298298
agents:
299-
- assistant
299+
- seclab_taskflow_agent.personalities.assistant
300300
user_prompt: |
301301
Clear the memory cache.
302302
toolboxes:
@@ -313,11 +313,11 @@ Example:
313313
- task:
314314
headless: true
315315
agents:
316-
- assistant
316+
- seclab_taskflow_agent.personalities.assistant
317317
user_prompt: |
318318
Store `hello` in the memory key `world`.
319319
toolboxes:
320-
- memcache
320+
- seclab_taskflow_agent.toolboxes.memcache
321321
env:
322322
MEMCACHE_STATE_DIR: "example_taskflow/"
323323
MEMCACHE_BACKEND: "dictionary_file"
@@ -335,20 +335,20 @@ globals:
335335
taskflow:
336336
- task:
337337
agents:
338-
- fruit_expert
338+
- examples.personalities.fruit_expert
339339
user_prompt: |
340340
Tell me more about {{ GLOBALS_fruit }}.
341341
```
342342
343343
### Reusable Tasks
344344
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.
346346

347347
Example:
348348

349349
```yaml
350350
- task:
351-
uses: single_step_taskflow
351+
uses: examples.taskflows.single_step_taskflow
352352
model: gpt-4o
353353
```
354354

@@ -386,15 +386,15 @@ A reusable taskflow can also have a templated prompt that takes inputs from its
386386

387387
```yaml
388388
- task:
389-
uses: single_step_taskflow
389+
uses: examples.taskflows.single_step_taskflow
390390
inputs:
391391
fruit: apples
392392
```
393393

394394
```yaml
395395
- task:
396396
agents:
397-
- fruit_expert
397+
- examples.personalities.fruit_expert
398398
user_prompt: |
399399
Tell me more about {{ INPUTS_fruit }}.
400400
```
@@ -404,14 +404,14 @@ In this case, the template parameter `{{ INPUTS_fruit }}` is replaced by the val
404404
```yaml
405405
- task:
406406
agents:
407-
- fruit_expert
407+
- examples.personalities.fruit_expert
408408
user_prompt: |
409409
Tell me more about apples.
410410
```
411411

412412
### Reusable Prompts
413413

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.
415415

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

@@ -451,7 +451,7 @@ Then the actual task becomes:
451451

452452
### Model config
453453

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`:
455455

456456
```yaml
457457
seclab-taskflow-agent:

0 commit comments

Comments
 (0)