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
2 changes: 1 addition & 1 deletion frontends/aiq_api/src/aiq_api/jobs/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def _get_worker_function_type(config: Any) -> str | None:
if config.workflow is None:
return None

if config.workflow.use_async_deep_research:
if getattr(config.workflow, "use_async_deep_research", False):
return _DEEP_RESEARCH_FUNCTION_TYPE
return None

Expand Down
5 changes: 4 additions & 1 deletion src/aiq_agent/agents/deep_researcher/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,10 @@ class DeepResearchWorkflowConfig(FunctionBaseConfig, name="deep_research_workflo
for the deep_research_agent. Use this as the workflow for evaluation.
"""

pass
use_async_deep_research: bool = Field(
default=False,
description="Submit deep research as an async job instead of running inline",
)


@register_function(config_type=DeepResearchWorkflowConfig, framework_wrappers=[LLMFrameworkEnum.LANGCHAIN])
Expand Down
12 changes: 9 additions & 3 deletions tests/aiq_agent/jobs/test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1188,17 +1188,23 @@ def test_register_custom_mapping(self):


def test_get_worker_function_type_maps_async_deep_research_flag():
"""Async deep research selects the deep research function type."""
"""Async deep research selects the deep research function type for supported workflows."""
from types import SimpleNamespace

from aiq_agent.agents.deep_researcher.register import DeepResearchWorkflowConfig
from aiq_api.jobs.runner import _get_worker_function_type

enabled_config = SimpleNamespace(workflow=SimpleNamespace(use_async_deep_research=True))
disabled_config = SimpleNamespace(workflow=SimpleNamespace(use_async_deep_research=False))
workflow = DeepResearchWorkflowConfig(use_async_deep_research=True)
enabled_config = SimpleNamespace(workflow=workflow)
disabled_config = SimpleNamespace(workflow=DeepResearchWorkflowConfig())
missing_flag_config = SimpleNamespace(workflow=SimpleNamespace())
no_workflow_config = SimpleNamespace(workflow=None)

assert workflow.use_async_deep_research is True
assert workflow.model_dump()["use_async_deep_research"] is True
assert _get_worker_function_type(enabled_config) == "deep_research_agent"
assert _get_worker_function_type(disabled_config) is None
assert _get_worker_function_type(missing_flag_config) is None
assert _get_worker_function_type(no_workflow_config) is None


Expand Down
Loading