Your question is Validate Agent Workflow DAG. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Given a workflow of n steps labeled 0 to n - 1, a list of directed edges dependencies where [a, b] means step a must run before step b, a list required_tools where required_tools[i] contains the tool names needed by step i, and a set available_tools, write a function that validates the workflow before execution. Return whether the graph is acyclic and whether every step's required tools are available. If valid, also return one valid execution order; otherwise return the cycle nodes and the steps with missing tools.
def validate_workflow(n, dependencies, required_tools, available_tools):