MCP-enabled multi-agent framework for declarative YAML-driven agentic workflows, used for AI-assisted code auditing, vulnerability triage, and security research with CodeQL integration.
The Security Lab Taskflow Agent is an MCP-enabled multi-Agent framework for declarative, YAML-driven agentic workflows.
Built on top of the OpenAI Agents SDK, it uses Pydantic for grammar validation and Jinja2 for template rendering.
The Taskflow Agent leverages a GitHub Workflow-esque YAML based grammar to perform a series of tasks using a set of Agents.
Its primary value proposition is as a CLI tool that allows users to quickly define and script Agentic workflows without having to write any code.
Agents are defined through personalities, that receive a task to complete, given a set of tools.
Agents can cooperate to complete sequences of tasks through so-called taskflows.
You can find a detailed overview of the taskflow grammar here and example taskflows here.
┌─────────────────────────────────────────────────────┐
│ CLI (cli.py) │
│ Typer-based entry point: -p, -t, -l, -g, -m, --resume, --lint│
└─────────────────────┬───────────────────────────────┘
│
┌─────────────────────▼───────────────────────────────┐
│ Runner (runner.py) │
│ Taskflow execution loop, model resolution, │
│ template rendering, session checkpointing │
└─────────────────────┬───────────────────────────────┘
│
┌─────────────────────▼───────────────────────────────┐
│ MCP Lifecycle (mcp_lifecycle.py) │
│ Server connection, cleanup, process management │
└─────────────────────┬───────────────────────────────┘
│
┌─────────────────────▼───────────────────────────────┐
│ Agent (agent.py) │
│ TaskAgent wrapper, hooks, OpenAI Agents SDK bridge │
└─────────────────────────────────────────────────────┘
Supporting modules:
models.py — Pydantic v2 grammar models (validation)
session.py — Task-level checkpoint / resume
available_tools.py — YAML resource loader with caching
template_utils.py — Jinja2 template environment
mcp_utils.py — MCP client parameter resolution
mcp_transport.py — MCP transport implementations (stdio, streamable)
mcp_prompt.py — System prompt construction
prompt_parser.py — Legacy prompt argument parser
capi.py — AI API endpoint and token management
path_utils.py — Platform-aware data/log directories
The agent supports both the Chat Completions and Responses OpenAI APIs.
The API type can be configured globally or per model in a model_config file:
seclab-taskflow-agent:
version: "1.0"
filetype: model_config
api_type: chat_completions # default for all models
models:
gpt_default: gpt-4.1
gpt_responses: gpt-5.1
model_settings:
gpt_responses:
api_type: responses # override for this model
endpoint: https://api.githubcopilot.com
token: CAPI_TOKEN # env var name containing the API key
Per-model model_settings can include:
api_type — "chat_completions" (default) or "responses"endpoint — API base URL override for this modeltoken — name of an environment variable containing the API keyThe runner can drive three SDKs behind a common interface:
openai_agents (default) — the OpenAI Agents Python SDK. Supports
multi-personality handoffs, both chat_completions and responses
api_type, temperature, parallel_tool_calls,
exclude_from_context, and MCP over stdio, SSE, and streamable HTTP.copilot_sdk — the GitHub Copilot Python SDK. Supports streaming,
reasoning_effort, MCP over stdio/SSE/HTTP, and per-tool permission
gating. The SDK selects its own wire protocol per model, so the YAML
api_type field is not honoured; multi-personality handoffs,
temperature, and parallel_tool_calls are likewise not available.
Taskflows that use unsupported fields fail at load time with a
BackendCapabilityError naming the offending field.anthropic_sdk — the Anthropic Python SDK, driving the native
Messages API (/v1/messages). Supports streaming, tool calling via
MCP, and adaptive thinking with configurable reasoning.effort
(low, medium, high, max). Handoffs are not supported.
Designed for use with CAPI's Anthropic endpoint; auth uses
Authorization: Bearer (not x-api-key).Selection precedence (highest to lowest):
backend: in the task's own model_settings block (overrides
the model-level value for that one task; see _resolve_task_model()).backend: in the model config's model_settings (allows
mixed backends in a single taskflow).backend: field at the top level of the model config document
(global default).SECLAB_TASKFLOW_BACKEND environment variable.openai_agents.seclab-taskflow-agent:
version: "1.0"
filetype: model_config
models:
code_analysis: claude-opus-4.7
general_tasks: gpt-5.4-mini
model_settings:
code_analysis:
api_type: messages
backend: anthropic_sdk
reasoning:
effort: high
general_tasks:
api_type: responses
backend: openai_agents
Each backend adapter translates its SDK-native exceptions into the neutral
hierarchy in sdk/errors.py, so the runner applies retry policy without
importing any SDK. Adding a backend means translating its errors too;
test_every_backend_adapter_translates_transport_failures enforces this
across the registry.
Transport failures need explicit handling and are easy to miss. The vendor
SDKs wrap httpx only around the call that sends the request, and with
streaming that returns once the response headers arrive while the body is
iterated afterwards. A connection that dies mid-body therefore surfaces as a
bare httpx error, in neither the SDK's own hierarchy nor the builtins'.
sdk/_transport.py enumerates the retriable ones, and each adapter maps them
to BackendTransportError. The set is enumerated rather than catching
httpx.TransportError wholesale, because LocalProtocolError means the
request was malformed and UnsupportedProtocol is deterministic.
Retry has a single owner: the branch, in _deploy_with_transport_retry. It is
the only level that resets capture state between attempts, so a tool result
recorded before a failure cannot be published twice or become the task's named
output, and it replays only the branch that failed rather than siblings that
may already have written to external systems. Retries are bounded by
TASK_RETRY_LIMIT with linear backoff from TASK_RETRY_BACKOFF.
Nothing above or below that retries the same classes. Retry loops nest, so a
class caught at two levels multiplies attempts rather than adding them, and
each attempt replays the whole conversation. drive_backend_stream retries
only BackendRateLimitError, where no content has been emitted yet, and takes
a reset_capture callback so even that path cannot leave a partial attempt's
results behind.