Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions available_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def __init__(self, yamls: dict):
self.taskflows = {}
self.prompts = {}
self.toolboxes = {}
self.model_config = {}

# Iterate through all the yaml files and divide them into categories.
# Each file should contain a header like this:
Expand All @@ -49,6 +50,8 @@ def __init__(self, yamls: dict):
add_yaml_to_dict(self.prompts, filekey, yaml)
elif filetype == 'toolbox':
add_yaml_to_dict(self.toolboxes, filekey, yaml)
elif filetype == 'model_config':
add_yaml_to_dict(self.model_config, filekey, yaml)
else:
raise FileTypeException(str(filetype))
except KeyError as err:
Expand Down
9 changes: 9 additions & 0 deletions configs/model_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
seclab-taskflow-agent:
version: 1
filetype: model_config
filekey: GitHubSecurityLab/seclab-taskflow-agent/configs/model_config
models:
sonnet_default: claude-sonnet-4
sonnet_latest: claude-sonnet-4.5
gpt_default: gpt-4.1
gpt_latest: gpt-5
Comment on lines +5 to +9
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The models key is at the wrong indentation level. Based on the code in main.py that accesses model_dict.get('models', {}), this key should be nested under the seclab-taskflow-agent header, not at the root level.

Suggested change
models:
sonnet_default: claude-sonnet-4
sonnet_latest: claude-sonnet-4.5
gpt_default: gpt-4.1
gpt_latest: gpt-5
models:
sonnet_default: claude-sonnet-4
sonnet_latest: claude-sonnet-4.5
gpt_default: gpt-4.1
gpt_latest: gpt-5

Copilot uses AI. Check for mistakes.
19 changes: 16 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,16 @@ async def on_handoff_hook(

# optional global vars available for the taskflow tasks
global_variables = taskflow.get('globals', {})
model_config = taskflow.get('model_config', {})
if model_config:
model_dict = available_tools.model_config.get(model_config, {})
if not model_dict:
raise ValueError(f"No such model config: {model_config}")
model_dict = model_dict.get('models', {})
if model_dict:
if not isinstance(model_dict, dict):
raise ValueError(f"Models section of the model_config file {model_config} must be a dictionary")
model_keys = model_dict.keys()

for task in taskflow['taskflow']:

Expand All @@ -448,7 +458,9 @@ async def on_handoff_hook(
for k,v in reusable_taskflow['taskflow'][0]['task'].items():
if k not in task_body:
task_body[k] = v

model = task_body.get('model', DEFAULT_MODEL)
if model in model_keys:
model = model_dict[model]
Comment on lines +461 to +463
Copy link

Copilot AI Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable model_keys is referenced before it may be defined. If model_config is not provided or model_dict is empty, model_keys will be undefined, causing a NameError. Initialize model_keys as an empty list before the conditional blocks or move the model resolution inside the if model_dict: block.

Copilot uses AI. Check for mistakes.
# parse our taskflow grammar
name = task_body.get('name', 'taskflow') # placeholder, not used yet
description = task_body.get('description', 'taskflow') # placeholder not used yet
Expand All @@ -465,7 +477,6 @@ async def on_handoff_hook(
toolboxes_override = task_body.get('toolboxes', [])
env = task_body.get('env', {})
repeat_prompt = task_body.get('repeat_prompt', False)
model = task_body.get('model', DEFAULT_MODEL)
# this will set Agent 'stop_on_first_tool' tool use behavior, which prevents output back to llm
exclude_from_context = task_body.get('exclude_from_context', False)
# this allows you to run repeated prompts concurrently with a limit
Expand Down Expand Up @@ -600,6 +611,7 @@ async def _deploy_task_agents(resolved_agents, prompt):
run_hooks=TaskRunHooks(
on_tool_end=on_tool_end_hook,
on_tool_start=on_tool_start_hook),
model = model,
agent_hooks=TaskAgentHooks(
on_handoff=on_handoff_hook))
return result
Expand Down Expand Up @@ -643,7 +655,8 @@ async def _deploy_task_agents(resolved_agents, prompt):
YamlParser(cwd).get_yaml_dict((cwd/'personalities').rglob('*')) |
YamlParser(cwd).get_yaml_dict((cwd/'taskflows').rglob('*')) |
YamlParser(cwd).get_yaml_dict((cwd/'prompts').rglob('*')) |
YamlParser(cwd).get_yaml_dict((cwd/'toolboxes').rglob('*')))
YamlParser(cwd).get_yaml_dict((cwd/'toolboxes').rglob('*')) |
YamlParser(cwd).get_yaml_dict((cwd/'configs').rglob('*')))

p, t, l, user_prompt, help_msg = parse_prompt_args(available_tools)

Expand Down
4 changes: 3 additions & 1 deletion taskflows/CVE-2023-2283/CVE-2023-2283.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ seclab-taskflow-agent:
filetype: taskflow
filekey: GitHubSecurityLab/seclab-taskflow-agent/taskflows/CVE-2023-2283/CVE-2023-2283

model_config: GitHubSecurityLab/seclab-taskflow-agent/configs/model_config

taskflow:
- task:
must_complete: true
Expand All @@ -14,7 +16,7 @@ taskflow:
toolboxes:
- GitHubSecurityLab/seclab-taskflow-agent/toolboxes/memcache
- task:
model: gpt-4.1
model: gpt_latest
must_complete: false
agents:
- GitHubSecurityLab/seclab-taskflow-agent/personalities/c_auditer
Expand Down